Update based on a query returning multiple values
UPDATE <table_name> <alias>
SET (<column_name>,<column_name> ) = (
SELECT (<column_name>, <column_name>)
FROM <table_name>
WHERE <alias.column_name> = <alias.column_name>)
WHERE <column_name> <condition> <value>;
Update the results of a SELECT statement
UPDATE (<SELECT Statement>)http://psoug.org/reference/update.html
SET <column_name> = <value>
WHERE <column_name> <condition> <value>;
Merge Statement Demo
MERGE <hint> INTO <table_name>
USING <table_view_or_query>
ON (<condition>)
WHEN MATCHED THEN <update_clause>
DELETE <where_clause>
WHEN NOT MATCHED THEN <insert_clause>
No comments:
Post a Comment