Home » SQL & PL/SQL » SQL & PL/SQL » Trigger
Trigger [message #8869] Tue, 30 September 2003 20:09 Go to next message
Dushm
Messages: 11
Registered: September 2002
Junior Member
I have a row level trigger for INSERT and UPDATE. My question is : Is it possible to see that the trigger is not fired when one particular column is updated ie

If my table TB1 has 4 columns col1,col2,col3,col4. I don't want the trigger to be fired if only col3 is updated.

Is this possible..?
Re: Trigger [message #8870 is a reply to message #8869] Tue, 30 September 2003 23:33 Go to previous messageGo to next message
Reema
Messages: 50
Registered: July 2003
Member
Hi,
In your trigger code you can include the statement
--before Update of Col3
This statement will invoke the trigger only when col3 is updated else it will not be fired.Any doubts you can revert back.
Re: Trigger [message #8888 is a reply to message #8870] Wed, 01 October 2003 11:36 Go to previous messageGo to next message
Dushm
Messages: 11
Registered: September 2002
Junior Member
Hi Reema,

Thanks for your reply.

My situation is , that the trigger should NOT be fired when col3 is updated. In realtime my table has around 25 columns.
Re: Trigger [message #8890 is a reply to message #8869] Wed, 01 October 2003 11:46 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
There's a big difference between not firing the trigger "when one particular column is updated" and "if only col3 is updated."

For the second statement, I would suggest something like:

before insert or update of col1, col2, col4, ..., col25 on t
Re: Trigger [message #8899 is a reply to message #8890] Wed, 01 October 2003 14:40 Go to previous messageGo to next message
Dushm
Messages: 11
Registered: September 2002
Junior Member
Hi Todd,

I want the trigger NOT to fire when col3 is updated.
Could you please let me know how it can be done.
Re: Trigger [message #8900 is a reply to message #8899] Wed, 01 October 2003 15:08 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
That's exactly what I was showing you - do you see col3 listed in the column list? No. If it is not there, the trigger will not fire.
Previous Topic: Compile all Code on DB Change?
Next Topic: Make an End to a user session
Goto Forum:
  


Current Time: Wed Apr 24 20:20:23 CDT 2024