|
-
Table Mutating
Hi Beejay,
The problem is simple. In line triggers (triggers you create
using the FOR EACH ROW sentence) you cannot use DML
(Select, Delete, Insert or Update) commands if the table
you`re using DML is the table the trigger runs the action.
Your code:
--you are creating a 'line trigger' for the table EMP
CREATE OR REPLACE TRIGGER SALCHK
BEFORE INSERT OR UPDATE ON EMP FOR EACH ROW
-- you are trying to use SELECT (DML command) with
the same table that the trigger uses.
SELECT MAX(SAL),MIN(SAL) INTO MAXSAL,MINSAL FROM EMP
Try doing this: Create a package with a type of table variable
and do this select there. And then use the information held in this variable in the 'trigger for each row'. If you don`t know how to do it, answer me and I`ll give you the code.
I hope you can do it.
F.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|