Created
June 6, 2016 17:42
-
-
Save ran488/d4d6a3dce4baeed8d4156c3a0c1752c3 to your computer and use it in GitHub Desktop.
Insert into an Oracle table only if it does not already exist (no errors)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- first SELECT has values you want to insert. | |
-- second SELECT has enough of those values to verify if record already exists (e.g. primary key) | |
insert into some_table(col1, col2) | |
select "value 1", "value 2" from dual where not exists | |
(select 1 from some_table where col1 = "value 1" and col2 = "value3") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment