Home » SQL & PL/SQL » SQL & PL/SQL » condition in triggers
condition in triggers [message #253965] Wed, 25 July 2007 06:58 Go to next message
Messages: 4
Registered: July 2007
Location: India
Junior Member

Hi All,
I just want to ask that is there any way to put conditions in trigger that it should fire only when the condition is satisfied?

Suppose I have an Employee table
columns are Empname, Empjob, salary and Deptno.

I want a insert trigger to be fired only when i insert a row in Employee table with job as manager
and if i insert row with job as Clerk or any job other than Manager then that trigger should not fire.

looking forward for your reply..

Thanks in advance
Re: condition in triggers [message #253973 is a reply to message #253965] Wed, 25 July 2007 07:13 Go to previous message
Messages: 2818
Registered: May 2007
Location: Scotland
Senior Member
Use the WHEN clause

for each row
WHEN (NEW.empjob = 'manager')
Previous Topic: how to connect default data base in oracle 10g?
Next Topic: Will the code be executed ???
Goto Forum:

Current Time: Wed Oct 26 15:06:14 CDT 2016

Total time taken to generate the page: 0.18165 seconds