Results 1 to 9 of 9

Thread: Trigger

  1. #1
    Join Date
    Jun 2003
    Posts
    294

    Unanswered: Trigger

    Hello,

    I'm creating a trigger that is trying to call an Stored procedure, but I think It's not able to do It.

    So I Created the trigger with a Function inside, and the function calls the trigger, but I recive an error when the function is Invoking the procedure.

    How do I call a procedure from a Trigger, or how do I call a procedure from a Function.

    Do you have any example???? (please attach the file)

    Thanks !!!!

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

    Re: Trigger

    Not possible, AFAIk

    Cheers
    Sathyaram

    Originally posted by jortiz
    Hello,

    I'm creating a trigger that is trying to call an Stored procedure, but I think It's not able to do It.

    So I Created the trigger with a Function inside, and the function calls the trigger, but I recive an error when the function is Invoking the procedure.

    How do I call a procedure from a Trigger, or how do I call a procedure from a Function.

    Do you have any example???? (please attach the file)

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

  3. #3
    Join Date
    Jun 2003
    Posts
    294

    Re: Trigger

    I have to call the procedure, Is there no solution ?????

    So what do I have to do ????

  4. #4
    Join Date
    Jun 2003
    Posts
    294

    Re: Trigger

    Is It not posible to call the procedure from a SQL UDF function made in Java ??


    How to do It?

  5. #5
    Join Date
    Jan 2004
    Location
    Argentina
    Posts
    6
    Read my post "DB2 UDF C TRIGGER problem", maybe it helps you in any way

    I cant understand why a SP cant be still triggered in DB2 too ...

    Greetings,
    Sudamericano.

  6. #6
    Join Date
    Jan 2004
    Location
    Argentina
    Posts
    6

  7. #7
    Join Date
    Jun 2003
    Posts
    294
    Gracias hermano !!!

    Definitivamente sigamos trabajando con Oracle

  8. #8
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    Hi

    Here is an example for DB2 V7 z/OS that works:

    CREATE TRIGGER DB2.VATI0026
    AFTER INSERT ON DB2.VATB0026 REFERENCING NEW AS N
    FOR EACH ROW MODE DB2SQL WHEN(N.HERK_KZ = 'V')
    BEGIN ATOMIC CALL VAUD0095
    (N.ZUG_ID ,N.INSERT_TIMESTAMP ,N.ZUG_STS ,N.HERK_KZ ) ; END

  9. #9
    Join Date
    Jan 2004
    Location
    Argentina
    Posts
    6
    ...

    "A Java stored procedure is defined in the database using the following statement:

    CREATE PROCEDURE PARTS_ON_HAND (IN PARTNUM INTEGER,
    OUT COST DECIMAL(7,2),
    OUT QUANTITY INTEGER)
    EXTERNAL NAME 'parts!onhand'
    LANGUAGE JAVA PARAMETER STYLE DB2GENERAL;



    A Java application calls this stored procedure using the following code fragment:
    ...
    CallableStatement stpCall ;
    String sql = "CALL PARTS_ON_HAND ( ?,?,? )" ;
    stpCall = con.prepareCall( sql ) ; /* con is the connection */
    stpCall.setInt( 1, variable1 ) ;
    stpCall.setBigDecimal( 2, variable2 ) ;
    stpCall.setInt( 3, variable3 ) ;

    stpCall.registerOutParameter( 2, Types.DECIMAL, 2 ) ;
    stpCall.registerOutParameter( 3, Types.INTEGER ) ;

    stpCall.execute() ;

    variable2 = stpCall.getBigDecimal(2) ;
    variable3 = stpCall.getInt(3) ;
    ... "

Posting Permissions

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