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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Convert complex sql delete statement to Oracle?

Re: Convert complex sql delete statement to Oracle?

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 20 Aug 2002 14:22:34 -0800
Message-ID: <3d62b31a@news.victoria.tc.ca>


Brad Pybus (brad_pybus7zwq_at_hotmail.com) wrote:
: I can do this statement in SQL Server but I can not figure out how to do it
: in Oracle. I just want it to delete records in Table1.

: DELETE A
: FROM TABLE1 A, TABLE2 B, TABLE3 C
: WHERE A.MYKEY= B.MYKEY AND A.UNIQUEKEY = B.UNIQUEKEY
: AND B.MYKEY= C.MYKEY
: AND C.KEY1 NOT BETWEEN 'A' AND 'Z';
You can't do this like this in oracle.

You have to do somthing like the following...

delete from table1
where exists (

	select * from  TABLE1 A, TABLE2 B, TABLE3 C
	where  A.MYKEY= B.MYKEY 
	AND A.UNIQUEKEY = B.UNIQUEKEY
	AND B.MYKEY= C.MYKEY
	AND C.KEY1 NOT BETWEEN 'A' AND 'Z' ) ;

(this is off the top of my head, so you need to check the logic very carefully ! ) Received on Tue Aug 20 2002 - 17:22:34 CDT

Original text of this message

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