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
singhabm
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
pablolee
Messages: 2844
Registered: May 2007
Location: Scotland
Senior Member
Use the WHEN clause

...
for each row
WHEN (NEW.empjob = 'manager')
BEGIN
... 
Previous Topic: Oracle 7.3 PL/SQL
Next Topic: VSIZE()
Goto Forum:
  


Current Time: Mon Aug 21 05:25:58 CDT 2017

Total time taken to generate the page: 0.01528 seconds