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 -> Re: Convert complex delete sql statement to Oracle?

Re: Convert complex delete sql statement to Oracle?

From: Brad Pybus <brad_pybus7zwq_at_hotmail.com>
Date: Tue, 20 Aug 2002 17:31:34 -0500
Message-ID: <Xqz89.1239$Bd4.10512@dfw-service2.ext.raytheon.com>

"Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote in message news:6qc5mu44gtq6v96rvffmlc6aoalc2mttc7_at_4ax.com...
> On Tue, 20 Aug 2002 15:55:50 -0500, "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';
> >
> >
> delete from table1 a
> where exists
> (select 'x'
> from table2 b
> , table3 c
> where b.mykey = c.mykey
> and c.key1 not between 'a' and 'z'
> and b.mykey = a.mykey
> )
>
> Next time, please try to do a little bit more effort before posting
> your dead easy question two times in short succession.
> This is just *standard* sql.

If its so easy then why is your answer so *obviously* incorrect. I would normally do exactly what you said except for the fact table table B has a composite primary key composed of MyKey and UniqueKey and it relates to table A which has a composite foreign key of MyKey and UniqueKey. Not only that, your solution fails to use UniqueKey at all!! Received on Tue Aug 20 2002 - 17:31:34 CDT

Original text of this message

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