Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Question on Using EXISTS Condition in a Trigger
Instead of
if exists (select 1 from mytable where mytable.id = :old.id) then
...
end if;
do
for r in (select 1 from mytable where mytable.id = :old.id) loop
...
end loop;
Martin
Ray Vonhollen wrote:
>
> I'm getting contrary information between earlier Oracle documentation on the
> proper use of the EXISTS condition and current useage in Oracle 8i. What I'm
> simply trying to accomplish is to see if a record(s) exists within a Delete
> After Trigger, and then perform some action if it does. I only need to find
> one record even though, many may exist.
>
> (Example)
>
> If EXISTS (Select 1 from Mytable where Mytable.ID = :OLD.ID) Then
> ..
> ..
> END IF;
>
> I've tried every combination including embedding the EXISTS after the Where
> clause, all to no 'proper' result.
>
> IF (Select DISTINCT 1 From MyTable Where Exists (Select DISTINCT 1 from
> MyTable Where (MyTable.ID = :OLD.ID))) Then
> END IF;
>
> Can someone supply me with the proper syntax in order to accomplish the above?
>
> Much appreciation for any help.
>
> R-
Received on Thu Mar 29 2001 - 21:40:05 CST
![]() |
![]() |