Merge and truncate in sql, PL-SQL Programming


SQL has two more table update operators, MERGE and TRUNCATE. MERGE, like INSERT, takes a source table s and uses it to update a target table t. Briefly, a MERGE statement specifies a matching condition to determine which rows of s have at least one matching row in t (under that specified matching condition). It then specifies an open-ended series of conditions to be applied to each row of s paired with actions to be applied on t.

WHEN MATCHED AND c1 THEN x1 specifies that action x1, necessarily an UPDATE or DELETE, is to be applied on t for each matching row in s that satisfies the condition c1. WHEN NOT MATCHED AND c2 THEN x2 specifies that action x2, necessarily an INSERT, is to be applied on t for each non-matching row in s that satisfies the condition c2. The curiously named TRUNCATE statement deletes all the rows from its specified target, bypassing any triggered actions, including compensatory actions, specified for that target. The target must be a base table.

Posted Date: 1/18/2013 11:40:57 PM | Location : United States

Related Discussions:- Merge and truncate in sql, Assignment Help, Ask Question on Merge and truncate in sql, Get Answer, Expert's Help, Merge and truncate in sql Discussions

Write discussion on Merge and truncate in sql
Your posts are moderated
Related Questions
PITS Depressions in secondary cell wall is called pit. A pit present on the free cell wall surface without its partner is called Blind pit. It consists of 2 parts -

What are the rates for help in writing PL/SQL procedures and functions?

Control Structures The Control structures are the most important PL/SQL extension to the SQL. Not only does PL/SQL let you manipulate Oracle data, it lets you process the data

Keyword & Parameter Description: PRAGMA: These keywords signify that the statement is a pragma (i.e. compiler directive). The Pragmas are processed at the compile time, n

Block Structure The PL/SQL is a block-structured language. That is, the fundamental units (procedures, anonymous blocks, and functions) that make up a PL/SQL program are logi

At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a trigger that automatically updates the stock level of all pr

Conditionals - SQL At first sight SQL does not appear to have a single operator for expressing logical implication. In this respect it would be in common with most programming

Description: Demonstrate your knowledge of PL/SQL programming by writing and thoroughly testing triggers and stored procedures associated with an e-commerce application that pr

FOR-LOOP While the number of iterations through a WHILE loop is unknown till the loop completes, then the number of iterations through a FOR loop is known before the loop is ent

Advantages of PL/SQL The PL/SQL is a high-performance transaction processing, completely portable language that offers the following advantages as shown: 1) Support for SQL