Results 1 to 2 of 2

Thread: DB2 Triggers

  1. #1
    Join Date
    Apr 2003
    Location
    Florida
    Posts
    79

    Question Unanswered: DB2 Triggers

    OS/390 DB2 v6.1
    Anyone know how to create a before trigger that will set my partition number - such as:

    CREATE TRIGGER FSDBA.FSSTULOG NO CASCADE
    BEFORE INSERT ON FSDBA.WWW_STUDENT_LOG
    REFERENCING NEW AS NEW_ROW
    FOR EACH ROW
    MODE DB2SQL
    BEGIN ATOMIC
    SET NEW_ROW.LOG_PARTITION = SELECT DAYOFWEEK(CURRENT_DATE) FROM SYSIBM.SYSDUMMY1
    ;
    END
    ;

  2. #2
    Join Date
    Apr 2003
    Location
    Florida
    Posts
    79
    Got it working:

    SET CURRENT SQLID = 'FSDBA';

    --#SET TERMINATOR ~

    CREATE TRIGGER FSDBA.FSSTULOG NO CASCADE

    BEFORE INSERT ON FSDBA.WWW_STUDENT_LOG REFERENCING NEW AS N

    FOR EACH ROW MODE DB2SQL

    BEGIN ATOMIC

    SET N.LOG_PARTITION = DAYOFWEEK(CURRENT_DATE);

    END ~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •