Results 1 to 3 of 3

Thread: Help Trigger

  1. #1
    Join Date
    Sep 2009
    Posts
    11

    Unanswered: Help Trigger

    Hello I could support, since I want to add the user who is deleting the record someone has an idea how could do to TRIGGER


    CREATE TRIGGER DB2INST1.BORRAACTAFTER DELETE ON DB2INST1.ACTCOPYREFERENCING OLD AS ORFOR EACH ROW MODE DB2SQLWHEN (O. ACTNO = '11')BEGIN ATOMICINSERT INTO DB2INST1.ACTDELE (ACTNO, ACTKWD, ACTDESC, TIME) VALUES (O.ACTNO, O.ACTKWD, O.ACTDESC, DEFAULT);END

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I'm not sure I understand what you're asking. There is a special register, CURRENT USER, which contains the ID of the connected user. You can reference it in your INSERT statement.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Sep 2009
    Posts
    11
    Hi I want to make is that when you clear a log also I throw the user who did it, as an audit. I am going to inquire about what me comment of CURRENT USER, I could do one but throw me all processes that the user has and only want the process that makes it

    CREATE TRIGGER DB2INST1.BORRAACT2
    AFTER DELETE ON DB2INST1.ACTCOPY
    REFERENCING OLD AS OR
    FOR EACH ROW MODE DB2SQL
    WHEN (O. ACTNO = '11')
    BEGIN ATOMIC
    INSERT INTO DB2INST1.ACTDELE1 SELECT ACT.ACTNO, ACT.ACTKWD, ACT.ACTDESC, ACT.TIME, SNAP.AGENT_ID, SNAP.CLIENT_NNAME, SNAP.PRIMARY_AUTH_ID FROM DB2INST1.ACTDELE ACT, SYSIBMADM.SNAPAPPL_INFO SNAP;
    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
  •