Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    austin,tx
    Posts
    104

    Unanswered: calling stored procedure from trigger

    I'm a DB2 newbie trying to call a stored procedure from a trigger.
    The stored procedure allocates a key which I need to set in my table.

    The procedure header looks like this:

    CREATE PROCEDURE mySchema.SP_GetKey_Param (
    IN v_objname VARCHAR(30),
    INOUT v_New_Key VARCHAR(32)
    DYNAMIC RESULT SETS 1
    LANGUAGE SQL
    ...

    Here's the trigger I'm trying to get working. I'm not sure of any of the syntax. Im getting the error:
    'An unexpected token "CALL" ...' when I try to define it.

    CREATE TRIGGER mySchema.TT_TEST_TABLE_INS
    BEFORE INSERT ON mySchema.TT_TEST_TABLE
    REFERENCING NEW AS inserted
    FOR EACH ROW
    MODE DB2SQL
    BEGIN ATOMIC

    DECLARE newKey VARCHAR(20) ;
    CALL mySchema.SP_GETKEY_PARAM ( 'TT_TEST_TABLE', newKey ) ;
    SET inserted.keyField = newKey ;
    END


    Any assistance is greatly appreciated. I'm using DB2 UDB 8.1 PE.
    -Craig

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

    Re: calling stored procedure from trigger

    Calling a Stored Procedure from a Trigger is not supported in DB2 on Unix and windows

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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