Home » SQL & PL/SQL » SQL & PL/SQL » Trigger in Function (Trigger used in Function)
Trigger in Function [message #275269] Fri, 19 October 2007 02:15 Go to next message
nirajksharmacpr
Messages: 19
Registered: October 2007
Location: Mumbai
Junior Member

Hi All
Can i Use the Trigger in the Function. Funnction Will Enable /Disable the Trigger and Trigger will Fired according to our requirement

Thanks in Advance..

Niraj Sharma
Re: Trigger in Function [message #275272 is a reply to message #275269] Fri, 19 October 2007 02:21 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:

Can i Use the Trigger in the Function

This is meaningless.

Quote:

Funnction Will Enable /Disable the Trigger and Trigger will Fired according to our requirement

This is a very bad design.
Use a procedure to implement the logic and not a trigger that is activated and deactivated in your function.
Why not putting the trigger code directly in the function and executing it or not when you want?

Regards
Michel
Re: Trigger in Function [message #275274 is a reply to message #275269] Fri, 19 October 2007 02:31 Go to previous messageGo to next message
nirajksharmacpr
Messages: 19
Registered: October 2007
Location: Mumbai
Junior Member

Hi All
Thanx i am Useing the SP for this.

Niraj Razz
Re: Trigger in Function [message #275317 is a reply to message #275274] Fri, 19 October 2007 07:59 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
Service Pack?
Re: Trigger in Function [message #275358 is a reply to message #275317] Fri, 19 October 2007 11:15 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Selfhelp Program
Re: Trigger in Function [message #275440 is a reply to message #275317] Sat, 20 October 2007 01:42 Go to previous messageGo to next message
nirajksharmacpr
Messages: 19
Registered: October 2007
Location: Mumbai
Junior Member

SP means Stored Procedures
Re: Trigger in Function [message #275738 is a reply to message #275440] Mon, 22 October 2007 09:47 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
nirajksharmacpr wrote on Sat, 20 October 2007 01:42

SP means Stored Procedures



If you say so
Re: Trigger in Function [message #275865 is a reply to message #275269] Tue, 23 October 2007 01:49 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
nirajksharmacpr wrote on Fri, 19 October 2007 09:15

Hi All
Can i Use the Trigger in the Function. Funnction Will Enable /Disable the Trigger and Trigger will Fired according to our requirement

Thanks in Advance..

Niraj Sharma

You might want to rethink your logic. Enabling/Disabling triggers is DDL. That's going to cost you a lot of resources. It is a bad idea. If you want a trigger to fire "accoding to your requirement", put some logic in the source of the trigger (or the function and forget about the trigger).

MHE
Previous Topic: ORA-00937 - Count() problem
Next Topic: Problem Involving Trigger
Goto Forum:
  


Current Time: Sat Dec 03 03:46:54 CST 2016

Total time taken to generate the page: 0.12910 seconds