Hi ,

I have two seperate triggers like,

CREATE TRIGGER cnt1
  AFTER INSERT
  ON tbl1
  WHEN (new.Id =1 and new.priority > 2 )
BEGIN
  update cnt set Critical = (SELECT Critical from msgs_cnt where Id=1) + 1 
where Id=1;
 end;

CREATE TRIGGER cnt2
  AFTER INSERT
  ON tbl1
  WHEN (new.Id =1 and new.priority < 2 )
BEGIN
  update cnt set Normal = (SELECT Normal from cnt where Id=1) + 1 where Id=1;
 end;

I am trying to combine these two trigs into one using if..else condition is it 
possible.

When i try it its giving me error. I tried the following way

CREATE TRIGGER cnt1
  AFTER INSERT
  ON tbl1
  WHEN (new.Id =1 )
BEGIN
 if( new.priority > 2)
  update cnt set Critical = (SELECT Critical from msgs_cnt where Id=1) + 1 
where Id=1;
else 
  update cnt set Normal = (SELECT Normal from cnt where Id=1) + 1 where Id=1;
end;


Is it possible to do some thing like this or it's too much of C.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to