Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> newbie -- best way to Insert where not exists
I'm inserting records in a loop, but it's possible that some keys exist already, so I want to code one statement that will insert the record only if it doesn't exist.
So I came up with:
insert into myTable select 'myValue' from dual where not exists (select * from myTable where mykey = 'myValue')
Does this look like the right way to do this?
Sent via Deja.com
http://www.deja.com/
Received on Wed Dec 20 2000 - 14:49:08 CST
![]() |
![]() |