Ines Liefeldt wrote:

>I want to write a trigger which should be executed after insert and
>also after update.

>How can it differ between insert and update? Is there any system
>variable or function or ..., which shows the trigger is activated by
>update or insert?

>I tried

>if updated then ...., but it is wrong.
  
> Can anybody help me?

Sorry, but there is no variable that tells you whether a trigger call is 
triggered by an insert or an update statement.
If you don't want to duplicate the code you could introduce a column 
UPDATED BOOLEAN DEFAULT FALSE to the trigger table.
If you set UPDATED = true whenever a row of the trigger is updated,
you can detect whether the call comes from an update statement 
(IF NEW.UPDATED = TRUE THEN ...).

Regards,
Thomas   


-- 
Thomas Anhaus
SAP DB, SAP Labs Berlin
[EMAIL PROTECTED]
http://www.sapdb.org/
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to