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
Develop Data Business Intelligence Project Project Description: We are linking our Microsoft SQL Database to GoodData Business Intelligence. We are seeking somebody who has e

LOB Types The large object (LOB) datatypes like BFILE, BLOB, CLOB, and NCLOB store the blocks of unstructured data (like graphic images, text, video clips, and sound waveforms)

Effects of NULL in Table Literal When a VALUES expression appears as the source value for an SQL INSERT statement, the key word NULL can appear as a field value, such that for

THEO R Y OF SPECIAL CREATION - Life originated on the earth due to natural events by the super natural power. The biblical story of creation of world within six days was p

BETWEEN Operator The operator BETWEEN, tests whether the value lies in a specified series. That means "greater than or equivalent to low value and less than or equivalent to hig

Write a pl/sql block that declares and uses cursors with parameters. In a loop, use a cursor to retrieve the department number and the department name from the departments table

Using FIRST and LAST FIRST and LAST return the first and last (minimum and maximum) index numbers in a collection. When the collection is empty, the FIRST and LAST return NULL

This task involves developing some functions that extract data from an SQL database. The scenario is that a company which owns an online vehicle search website wants to generate so

THEORY OF BIOGENESIS - This theory explains that the existing living organisms originated from pre-existing living beings not from non living entities. This concept of or

Organi c Evolution Evolution is a slow continuous, irreversible and natural process of change to give rise to advance and diverse forms of life i.e. formation of new specie