Home » SQL & PL/SQL » SQL & PL/SQL » Trigger (merged)
Trigger (merged) [message #379005] Sat, 03 January 2009 21:35 Go to next message
rajput.anshu
Messages: 45
Registered: October 2008
Location: Bangalore
Member
What is mutating trigger?
Re: Trigger [message #379007 is a reply to message #379005] Sat, 03 January 2009 21:48 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

There were lots of discussion on mutating triggers on this forum before. Just search for it .

Here are some examples

link 1

link 2

Smile
Rajuvan
Re: Trigger [message #379008 is a reply to message #379007] Sat, 03 January 2009 21:52 Go to previous messageGo to next message
rajput.anshu
Messages: 45
Registered: October 2008
Location: Bangalore
Member
The links given by you is Mutating table.....Is the mutating table and mutating trigger is same??
Re: Trigger [message #379011 is a reply to message #379005] Sat, 03 January 2009 22:08 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

hmhm ...

Have you gone through the link ?

Smile
Rajuvan.


Re: Trigger [message #379013 is a reply to message #379011] Sat, 03 January 2009 22:15 Go to previous messageGo to next message
rajput.anshu
Messages: 45
Registered: October 2008
Location: Bangalore
Member
Yaa i seen there, in heading it showing Avoiding Mutating table.........I don't know about mutating trigger.......that's what i am asking to you mutating table and mutating trigger is same.
Re: Trigger [message #379027 is a reply to message #379005] Sun, 04 January 2009 01:05 Go to previous messageGo to next message
BlackSwan
Messages: 25035
Registered: January 2009
Location: SoCal
Senior Member
>that's what i am asking to you mutating table and mutating trigger is same.

OK, I give up.
How exactly do YOU differentate the difference between a mutating table & trigger?

You claim a difference between the two. What is it?

If you know no difference, then NONE exists!
Please make up YOUR mind!
Re: Trigger [message #379029 is a reply to message #379005] Sun, 04 January 2009 01:23 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8625
Registered: November 2002
Location: California, USA
Senior Member
"Mutating trigger" is actually incorrect terminology, even though you hear it a lot. Triggers don't mutate. Tables mutate. Problems with mutating tables are caused by triggers. So, when somebody incorrectly refers to a "mutating trigger" problem, they are actually referring to a mutating table problem caused by a trigger.

Re: Trigger [message #379044 is a reply to message #379029] Sun, 04 January 2009 03:22 Go to previous messageGo to next message
rajput.anshu
Messages: 45
Registered: October 2008
Location: Bangalore
Member
Thanks a lot.
Trigger [message #379046 is a reply to message #379005] Sun, 04 January 2009 03:43 Go to previous messageGo to next message
rajput.anshu
Messages: 45
Registered: October 2008
Location: Bangalore
Member
I ask a question for the mutating trigger but moderator moved it to homework and training........My doubt is clear about mutating trigger.....I got this link from one of the user....
http://www.oracle-base.com/articles/9i/MutatingTableExceptions.php
but in this link i didn't understand that from where we call a tab1_row_change procedure in package trigger_api.

[Updated on: Sun, 04 January 2009 04:25]

Report message to a moderator

Re: Trigger [message #379055 is a reply to message #379046] Sun, 04 January 2009 04:48 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8625
Registered: November 2002
Location: California, USA
Senior Member
Trigger_api is a package.
Tab1_row_change is a procedure within the trigger_api package.
Tab1_ariu_trg is a trigger.

Within the tab1_ariu_trg trigger there is a line that begins with trigger_api.tab1_row_change that executes the tab1_row_change procedure of the trigger_api package.

I have moved this question to the homework forum. As you are a student and these are elementary questions, please post such future questions in the homework forum that is designed for providing appropriate help for this level of question from students. The other forums expect more complex problems from professionals within the field.



Re: Trigger [message #379080 is a reply to message #379055] Sun, 04 January 2009 10:18 Go to previous messageGo to next message
rajput.anshu
Messages: 45
Registered: October 2008
Location: Bangalore
Member
I am very sorry Barbara.................. By mistake i wrote there Trigger_api Package I knew that one.............One more package is there name as same Trigger_api just down the cursor...............In that 2nd package named Trigger_api from where we call a tab1_statement_change(procedure) because from the trigger tab1_asiu_trg we are calling statement level trigger trigger_api.tab1_statement_change................At last my doubt is that from where we calling row level trigger tab1_row_change(Its a procedure)................Thanks

[Updated on: Sun, 04 January 2009 10:20]

Report message to a moderator

Re: Trigger [message #379090 is a reply to message #379080] Sun, 04 January 2009 13:36 Go to previous message
Barbara Boehmer
Messages: 8625
Registered: November 2002
Location: California, USA
Senior Member
It is difficult to understand you. I am not sure if you are saying that you understand now or you are still asking a question. I don't like the particular example in the link that you were given, because it uses the word trigger in names of things that aren't triggers, which causes confusion.

I am not sure if you are clear on how triggers work. Triggers are fired automatically when an event occurs. Triggers are not called. A trigger can call a procedure or access an array in a package. When there are multiple types of triggers, first the before statement level triggers fire, then for each row the before row and after row triggers fire, then lastly the after statement level triggers fire.

Here is a link that I prefer that has a good method, with good accompanying explanation by Tom Kyte:

http://asktom.oracle.com/tkyte/Mutate/index.html

In the above link, a before statement trigger empties the array in the package, then a row trigger stores what is needed from each row in the array in the package, then an after statement trigger processes each of the rows that has been stored in the array in the package. It does this by accessing just a simple package specification without a package body or any procedures.


Previous Topic: Complex View
Next Topic: Delete small expiry date against pcode
Goto Forum:
  


Current Time: Sat Dec 03 20:34:36 CST 2016

Total time taken to generate the page: 0.07849 seconds