Home » SQL & PL/SQL » SQL & PL/SQL » procedure within a trigger
procedure within a trigger [message #231490] Tue, 17 April 2007 05:02 Go to next message
priya.vmr
Messages: 5
Registered: October 2006
Junior Member
Hi frns,

my doubt is can we execute a stored procedure inside a trigger.

Thanks in advance.
priya
Re: procedure within a trigger [message #231491 is a reply to message #231490] Tue, 17 April 2007 05:04 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
What happens if you try it?

MHE
Re: procedure within a trigger [message #231493 is a reply to message #231490] Tue, 17 April 2007 05:13 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
A good trigger is a trigger that contains only a call to a procedure.

Regards
Michel
Re: procedure within a trigger [message #231503 is a reply to message #231493] Tue, 17 April 2007 05:50 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
A good trigger only does a select nextval into id.
Re: procedure within a trigger [message #231611 is a reply to message #231490] Tue, 17 April 2007 12:57 Go to previous messageGo to next message
michael_bialik
Messages: 611
Registered: July 2006
Senior Member
Quote:
A good trigger is a trigger that contains only a call to a procedure.


And the procedure does NOT do COMMIT (unless it's AUTONOMOUS TRANSACTION).

Re: procedure within a trigger [message #231626 is a reply to message #231611] Tue, 17 April 2007 14:26 Go to previous messageGo to next message
gururajster
Messages: 26
Registered: October 2006
Location: bangalorre
Junior Member

yes, we can execute procedure inside a trigger.But my question can we create a procedure inside a trigger?
-Guru
Re: procedure within a trigger [message #231627 is a reply to message #231490] Tue, 17 April 2007 14:50 Go to previous messageGo to next message
BlackSwan
Messages: 25041
Registered: January 2009
Location: SoCal
Senior Member
>But my question can we create a procedure inside a trigger?
It is bad, bad, bad, bad practice to create object(s) via PL/SQL!
It was NEVER intended for such abuse.
Re: procedure within a trigger [message #231628 is a reply to message #231626] Tue, 17 April 2007 14:59 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
gururajster wrote on Tue, 17 April 2007 15:26
yes, we can execute procedure inside a trigger.But my question can we create a procedure inside a trigger?



And what do you think would happen when the trigger executes again?
Re: procedure within a trigger [message #231642 is a reply to message #231628] Tue, 17 April 2007 16:04 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Next time some analyst or designer or whatever comes up to you asking you 'Is it possible to do .....', you answer them as follows:
"Everything is possible, but WHY do you want to do that?"
Always, always ask yourself "Why am I doing this, Why do 'they' want it done this way", if you are doing something out of the ordinary.
I guarantee you > 80% of the time people get stuck thinking in terms of solutions instead of analysing what the actual problem is they are trying to solve.
Do NOT be afraid to stand up. In the end people will appreciate it and consider you a valuable developer.
Previous Topic: Insert missing row
Next Topic: Comparing two attributes based on another one
Goto Forum:
  


Current Time: Tue Dec 06 10:38:24 CST 2016

Total time taken to generate the page: 0.05772 seconds