Mutating Triggers [message #347776] |
Sat, 13 September 2008 21:21 |
prachi.mgorwadkar
Messages: 75 Registered: May 2007 Location: Pune
|
Member |
|
|
Hello All,
I have 2 queries regarding Triggers as:-
1>
Can we change the value of :NEW in a trigger?
Like -
CREATE TRIGGER t1
AFTER UPDATE ON emp
BEGIN
:NEW := 'xyz';
END;
2>
If my trigger is mutating, means like below given:
CREATE TRIGGER t1
AFTER UPDATE ON emp
BEGIN
SELECT eno, enamen esal FROM emp
WHERE enam LIKE 'P%';
END;
And, now I try to UPDATE the table emp, I will get the mutating trigger error.
But, now if, I want to use this without causing error, Is there any clause in Oracle?
Thanks and Regards,
-Prachi
|
|
|
|
Re: Mutating Triggers [message #347781 is a reply to message #347778] |
Sat, 13 September 2008 22:20 |
prachi.mgorwadkar
Messages: 75 Registered: May 2007 Location: Pune
|
Member |
|
|
I am very sorry if I made any mistakes.
As, I provided all relevant information also.
I am polite also.
But can you please notify exactly what fault I made?
Thanks and Regards,
-Prachi
|
|
|
|
|
|
|
|
|
Re: Mutating Triggers [message #347805 is a reply to message #347787] |
Sun, 14 September 2008 02:13 |
prachi.mgorwadkar
Messages: 75 Registered: May 2007 Location: Pune
|
Member |
|
|
Sir,
Please clarify this :
Make sure that lines of code do not exceed 80 characters when you format.
As I think,
1> All of you do not like using shortcuts.
2> You want a better explanation of our problems.
3> You actually want to see what we people tried.
If, the example we tried is very much short like say 6-7 lines, we think it is better to show it here instead of attaching a separate file.
Then, in such cases is it really possible to minimize the code up to 80 characters?
Thanks
-Prachi G.
|
|
|
Re: Mutating Triggers [message #347808 is a reply to message #347804] |
Sun, 14 September 2008 02:19 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
prachi.mgorwadkar wrote on Sun, 14 September 2008 09:09 | I am sorry , I did not mention in the example the trigger as a ROW Level trigger. It must be a Row Level Trigger for using NEW and OLD.
|
Mutating table errors also only occur on ROW level triggers; hence you put in two flawed examples.
Why not simply copy-paste instead of typing new code full of errors and omissions?
|
|
|
|
|