grammar :
MERGE INTO ( ) A
USING (
) B ON ( )
WHEN MATCHED THEN
Write update statements or other statements :UPDATE SET ....
WHEN NOT MATCHED THEN
Write insert statements or other statements :
INSERT ( Field ) VALUES( data source );
analysis :
MERGE INTO ( Query all the data ) A
USING (
Query the data to be compared or matched SQL
) B ON ( Data matching or comparison , such as A = B )
WHEN MATCHED THEN -- The meaning of this match is to update the statement
Write update statements or other statements :UPDATE SET ....
WHEN NOT MATCHED THEN -- This means that the insert statement is executed after the mismatch
Write insert statements or other statements :
INSERT ( Field ) VALUES( data source );
Search for
Copy
MERGE INTO ( Query all the data ) A
USING (
Query the data to be compared or matched SQL
) B ON ( Data matching , such as A = B )
WHEN MATCHED THEN -- The meaning of this match is to update the statement
Write update statements or other statements :UPDATE
SET ....
WHEN NOT MATCHED THEN -- This means that the insert statement is executed after the mismatch
Write insert statements or other statements :
INSERT (
Field
)
VALUES
(
data source
);
MERGE INTO ( Query all the data ) A
USING (
Query the data to be compared or matched SQL
) B ON ( Data matching , such as A = B )
WHEN MATCHED THEN -- The meaning of this match is to update the statement
Write update statements or other statements :UPDATE
SET ....
WHEN NOT MATCHED THEN -- This means that the insert statement is executed after the mismatch
Write insert statements or other statements :
INSERT (
Field
)
VALUES
(
data source
);