Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Unanswered: Capture error description in SP

    hi

    db2 8.2 in win.

    I have this sp:
    -------------------------------
    create procedure()
    language sql
    begin atomic
    declare ..... (my variables)
    declare continue handler for sqlexeption, sqlwarning, not found
    begin
    set retcode = sqlexception;
    end;
    for v1 as
    select ....
    do
    insert
    GET DIAGNOSTIC EXCEPTION 1 SQLDESCRIP = MESSAGE_TEXT;
    end for
    end
    -------------------------------


    the problem is: SQLDESCRIP never return a value o description.
    the questionis: any know how work this MESSAGE_TEXT???

    TIA
    abel-

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You need to do it this way:

    create procedure()
    language sql
    begin atomic
    declare ..... (my variables)
    declare continue handler for sqlexeption, sqlwarning, not found
    begin
    GET DIAGNOSTIC EXCEPTION 1 SQLDESCRIP = MESSAGE_TEXT;
    set retcode = sqlexception;
    end;
    for v1 as
    select ....
    do
    insert
    end for
    end
    -------------------------------

    The manual say that the GET DIAGNOSTIC needs to be in the condition handler.

    HTH

    Andy

  3. #3
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276
    Perfect!!!!!
    this work fine!!!

    very, very thanks.
    Abel.

Posting Permissions

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