Skip to content

Instantly share code, notes, and snippets.

@larshp
Created December 20, 2019 06:49
Show Gist options
  • Save larshp/d53cbc8cc414e86bfc9fa9e1b6f3364e to your computer and use it in GitHub Desktop.
Save larshp/d53cbc8cc414e86bfc9fa9e1b6f3364e to your computer and use it in GitHub Desktop.
MERGE INTO schema.table t
USING
(SELECT ? field1, ? field2 FROM dual) s
ON
(t.field1 = s.field1)
WHEN MATCHED THEN
UPDATE SET t.field2 = s.field2
WHEN NOT MATCHED THEN
INSERT (field1, field2) values (s.field1, s.field2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment