Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> newbie -- best way to Insert where not exists

newbie -- best way to Insert where not exists

From: <jimbo1155_at_my-deja.com>
Date: Wed, 20 Dec 2000 20:49:08 GMT
Message-ID: <91r601$lea$1@nnrp1.deja.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US