Guido W. Schmidt wrote :

>I tried hard to reimplement some db triggers in sapdb. One simple problem is
>that a column of type timestamp should be filled with the value of the
>system watch with the value of the execution time.
>I need something like

>CREATE TRIGGER TR_MYTAB FOR TAB_MYTAB BEFORE
>INSERT, UPDATE
>EXECUTE (SET NEW.DATEOFUPDATE=CURDATE();)

>Two things won't work. There are no BEFORE-triggers in sapdb and CURDATE();
>is of type DATE and not of type TIMESTAMP.
>Is there a way out. Other similar purposes are information columns which
>user or process changed the record lately.

Sorry, but SAPDB does not support BEFORE statement triggers. You may try
to simulate the behavior by an AFTER statement trigger, which updates
the row after inserting or updating :

CREATE TRIGGER TR_MAYTAB FOR TAB_MYTAB AFTER INSERT,UPDATE
EXECUTE (
UPDATE USER.TAB_MYTAB SET DATEOFUPDATE = TIMESTAMP WHERE
       TAB_MYTAB.KEYCOLUMN = :KEYCOLUMN IGNORE TRIGGER;
); 

I assumed the key of your table is named KEYCOLUMN. Please substitute this
name by the key of your table.

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