create trigger DB.Trg_Upd_Sample
before update ON SDB.Test
FOR EACH ROW
BEGIN
If NEW.rowstatus = 0 Then
Update Test set new.rowstatus =1 where TestId = new.TestId;
End If ;
End ;
create trigger DB.Trg_Upd_Sample
before update ON SDB.Test
FOR EACH ROW
BEGIN
If NEW.rowstatus = 0 Then
Set New.rowstatus = 2 ;
End If ;
End ;
The OLD and NEW keywords enable you to access columns in the rows affected by a trigger. (OLD and NEW are not case sensitive.) In an INSERT trigger, only NEW.col_name can be used; there is no old row. In a DELETE trigger, only OLD.col_name can be used; there is no new row. In an UPDATE trigger, you can use OLD.col_name to refer to the columns of a row before it is updated and NEW.col_name to refer to the columns of the row after it is updated.
Franck Leveneur
GreenLit Design
No comments:
Post a Comment