Re: rookie deleting records

From: GHouck <hksys_at_teleport.com>
Date: Mon, 28 Feb 2000 20:52:41 -0800
Message-ID: <38BB5099.4500_at_teleport.com>


Tim Downs wrote:
>
> I'm trying to delete records from a table based on another table and
> can't seem to get it to work. I can select the records I want to delete
> using the following syntax but I can't seem to get the delete syntax to
> work.
>
> select reqline.req_number, reqheader.req_number
> from reqline, reqheader
> where rewline.req_number = reqheader.req_number(+)
> and reqheader.req_number is null;
>
> tia
>
> Tim

Unless I'm missing something ...

Why are you testing

  reqheader.req_number = reqline.req_number   AND
  reqheader.req_number is NULL ?

If it is NULL, it's not going to be equal to anything. Except, perhaps, another NULL.

Typically, you can:

delete from deltable DT where exists
( select 'x' from tstTable TT where DT.key1=TT.key1 [and DT.key2=TT.key2 [and...]] );

Yours,

Geoff Houck
systems hk
hksys_at_teleport.com
http://www.teleport.com/~hksys Received on Tue Feb 29 2000 - 05:52:41 CET

Original text of this message