Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: trigger question
What is the purpos of this code?
It looks like you trying to simulate a delete cascade.
You would better use an appropiate constraint definition.
If that's not the purpose and your rowcount is the total number of rows in
that table you could perform a
select count(*) into <any *package*> variable
from table
and decrement the package variable before row, and refer to the package
variable in the rest of your code.
This strategy looks cumbersome too, as the delete shouldn't do anything is
the relationship has been correctly maintained.
Hth,
Sybrand Bakker, Oracle DBA
"luio" <lctNOlcSPAM_at_hotmail.com.invalid> wrote in message
news:042bd014.faae8feb_at_usw-ex0104-028.remarq.com...
> actual code is like this:
> create trigger after delete on table1 for each row
> begin
> --if SQL%rowcount = 0 then return; end if;
> delete from table2 where table2.Id = :old.sId;
> end;
>
>
> the commented line is trying to check if the row count affected
> is 0. if 0 return, if not, go on.
>
>
> -----------------------------------------------------------
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
>
Received on Tue Aug 01 2000 - 00:00:00 CDT
![]() |
![]() |