Skip to content

Instantly share code, notes, and snippets.

@jpgreenwald
Created July 11, 2013 22:07
Show Gist options
  • Save jpgreenwald/5979686 to your computer and use it in GitHub Desktop.
Save jpgreenwald/5979686 to your computer and use it in GitHub Desktop.
Oracle Upsert using merge
MERGE INTO target_name T USING
( select 1 from dual) S ON
( clause_that_finds_record inside T )
WHEN MATCHED THEN UPDATE
SET update_what_you_want_in_T
WHEN NOT MATCHED THEN
INSERT(
stuff_in_t
) VALUES( ...values... );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment