Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    14

    Unanswered: How do you call a stored procedure using a trigger?

    How do you call a stored procedure using a trigger?
    On insertion of a record into the table the trigger should call a stored procedure.How do we go about doing this..

    Thanks,
    Deepak B G

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: How do you call a stored procedure using a trigger?

    As far as I remember, as of now , you cannot call a SP from a trigger in DB2 LUW ... DB2 for z/os permits this ..

    My apologies if I'm wrong

    Sathyaram

    Originally posted by bgdeepak
    How do you call a stored procedure using a trigger?
    On insertion of a record into the table the trigger should call a stored procedure.How do we go about doing this..

    Thanks,
    Deepak B G
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Dec 2003
    Posts
    1

    call a SP from a DB2 trigger example

    IBM 390 MF using DB2 Vr 7.2.01

    try this for the TRIGGER

    CREATE TRIGGER subsystem.trigger-name AFTER UPDATE
    ON subsystem.table-name
    REFERENCING OLD AS OLD
    NEW AS NEW
    FOR EACH ROW MODE DB2SQL
    BEGIN ATOMIC
    CALL subsystem.procedure-name (
    NEW.column_value1,
    OLD.column_value1,
    CURRENT TIMESTAMP,
    );
    END

    you don't need the "current timestamp" but I just put it in there to show it can be done.
    AFTER UPDATE can be changed to BEFORE UPDATE if you want

    we've just successfuly done this.
    using a DB2 trigger, call a DB2 Stored procedure written in COBOL.
    what a pain in the @#$@#..

    the only down side is I'm having problems "calling" other existing COBOL programs.. without this, I'm not sure what value these will add to our systems.

Posting Permissions

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