bonjour,

Le dimanche 16 mai 2004, H a �crit...


> I finally got something to compile and work as a trigger... I just need a couple of 
> missing pieces.  What I want is a trigger that before an INSERT or UPDATE will set a 
> DATEfield to the current-date and a TIME field to the current time.  What I have so 
> far is below:

> CREATE  TRIGGER UpdateDateTime for cm.todo
>     after  INSERT 
>     execute 
>     (
>     update cm.todo set complete = 'R' where id = :new.id ;
>     )

Here is on of mines, for historical purpose:


CREATE TRIGGER TGU_HISTORIQUE FOR GARANTIEINTRANT AFTER UPDATE EXECUTE
(
    TRY
        INSERT INTO JM.HISTORIQUEGARANTIEINTRANT VALUES
        (
            :OLD.IDGARANTIE,
            :OLD.IDINTRANT,
            :OLD.IDETABLISSEMENT,
            (SELECT DATE FROM SYSDBA.DUAL),
            :OLD.DEBUTGARANTIE,
            :OLD.FINGARANTIE
        );
    CATCH
        IF $RC <> 0 THEN STOP ($RC, 'Historisation impossible');
)

-- 
jm


-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to