Databases :: SQL Compatibility issues :: oracle equivalent to not exists |
|||
| By: kurtsThyme |
Date: 04/10/2005 18:34:26 |
Points: 20 | Status: Answered Quality : Excellent |
|
What is the oracle equal to If not exists (select * from table where tableID=1) begin insert into table(tableID,label) values(1,newLabel) end |
|||
| By: VGR | Date: 04/10/2005 20:51:00 | Type : Answer |
|
| Hello ;-) You may try something like this : DECLARE exists PLS_INTEGER; BEGIN select count(*) into exists from table where tableID=1; if exists = 0 then execute immediate 'insert into table(tableID,label) values(1,newLabel)'; end if; END; / |
|||
| By: VGR | Date: 09/10/2005 09:52:38 | Type : Comment |
|
| fair enough ? Don't forget to post feedback or to close the question (button "A" like Accept or "S" like Split) ;-) | |||
| By: OpConsole | Date: 13/11/2005 12:19:25 | Type : Comment |
|
| Hello. This is the last reminder before forced closure of the Question. Suggested choice : Accept last VGR answer. You may Accept or Split the answer by clicking on the relevant button of the relevant comment ;-) Regards |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








