Using SQL%Rowcount inside trigger [message #41360] |
Sat, 21 December 2002 05:13 |
prashant
Messages: 122 Registered: September 2000
|
Senior Member |
|
|
Hi all
I am facing a small problem here. What I want to do is that whenever somebody
issues an update or delete command, if the number of rows afftected is
more than say 100 then i want that transaction to fail.
In cases of deletes what i am doing is , I have a packaged variable and
I have two triggers, one before delete, in which i do a select count(*)
from the table and store it in the packaged variable and
an after delete, in which i again do a select count(*) and then compare the
2 counts and if the difference is more than 100 then i use
Raise_application_error. But i dont want to use this method cos there can be a
possibility of the the second count showing incorrect result because of some other
committed transactions.
Also this method cannot be used for updates.
Now i have tried to use the implicit cursor attribute SQL%Rowcount inside the trigger
body of the "after update" trigger but it is always null.
Can somebody help me out here in finding out the number of rows affected and use it inside
the trigger.
Thanks in advance
|
|
|
|
|