|
|
|
Re: Urgent: Trigger updating the table itself on which trigger is written [message #383249 is a reply to message #383055] |
Tue, 27 January 2009 23:43 |
ide007
Messages: 5 Registered: October 2008
|
Junior Member |
|
|
Hi,
thanks.
Please see the trigger code below. I need an after insert trigger only as I have to update the same table on which I am writing the trigger.
CODE:
------
create table ttab1
(
tno number(4),
tname varchar2(30),
tcomm varchar2(30)
);
create table ttab2
(
tno1 number(4),
tname1 varchar2(30),
tcomm1 varchar2(30)
);
CREATE OR REPLACE TRIGGER apps.ttab1_trig
AFTER INSERT ON ttab1 FOR EACH ROW
WHEN (new.tno = 10)
BEGIN
UPDATE ttab1
SET tcomm = (SELECT tcomm1
FROM ttab2
WHERE tname1 = :new.tname);
END ttab1_trig;
insert into ttab2
values(1, 'TEST', 'SHIP_M');
commit;
insert into ttab1
values(10, 'TEST', '');
Now when I am trying to execute the above insert statement,
I am getting ORA-04091 9table is mutating; trigger/function may not see it).
Can you please help me in resolving it?
[EDITED by LF: applied [code] tags]
[Updated on: Thu, 29 January 2009 03:07] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: Urgent: Trigger updating the table itself on which trigger is written [message #383466 is a reply to message #383269] |
Thu, 29 January 2009 00:04 |
ide007
Messages: 5 Registered: October 2008
|
Junior Member |
|
|
Hi Michel,
thanks for your remarks. And I would like to let you know that I am very much aware how to search FAQ for this and not only FAQ there are many other places where I could search for this error. And I already had search results for the same error but my requirement was something different for which I posted it.
Anyway I could resolve this by my own. Regarding formatting,
I may not have formatted my post properly but what I can see is that most of these posts are like this.
Thanks
|
|
|
|
Re: Urgent: Trigger updating the table itself on which trigger is written [message #383558 is a reply to message #383492] |
Thu, 29 January 2009 03:00 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Quote: |
And you can see than in most posts I ask for formatting
|
And how much do I wish you'd give it a rest?
You've been repetatively posting the same requests for over 6 months, and other than giving you a huge posts total, it's had no observable impact on the quality of posts here.
It just serves to reduce the Useful Posts : Noise ratio and I suspect, to discourage people from posting here by making the site appear less welcoming and more officious.
Yes - formatting does help, but given that the OP had posted a decent test case showing his problem, the fact that it was not formatted is virtually irrelevant.
The test case was there - either provide help, or stop complaining and don't post to the thread.
Quote: |
If most people start to rape or kill, do you also do it?
|
Well, that's a non-combatative and well reasoned argument, if ever I saw one.
|
|
|