Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    10

    Unanswered: How to handle SQL RETURN CODE in SPL

    Hi,
    New in informix,need help for
    __________________________________________________ ___________
    "How to handle the return code from query in informix SPL and TRACE the message of the SQLCODE and resume the control after that " .i have many SQL statements and want to do it for each .
    __________________________________________________ ____________
    Thanx & Regards
    upsingh

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780
    Hi,
    Please read about ON EXCEPTION section and RAISE EXEPTION sintax.
    Ex: RAISE EXCEPTION -746, 0, 'You broke the rules';

    Gustavo.

  3. #3
    Join Date
    Apr 2004
    Location
    Brussels
    Posts
    57
    I had it open on another window,
    make something like this,
    and put it after your defines and before your instructions

    ON EXCEPTION SET error_num, isam_num, error_msg
    trace 'Error at label : ' || label ;
    trace 'Error: ' || error_num || ' ' || error_msg;
    return -1 ;
    END EXCEPTION;

    on exception in (-239) SET error_num, isam_num, error_msg -- if record already exists
    trace 'Warning at label=' || label || ' ' || error_num || ' ' || error_msg;
    trace 'Record already exists, key is ' || v_key ;
    trace 'Continue with procedure';
    end exception with resume;

  4. #4
    Join Date
    Aug 2004
    Posts
    10

    Smile Thanx ,its working

    Thanx supinformix,
    i am done with that and its working fine
    ON EXCEPTION SET SQLERR,ISAMERR,ERRMSG
    END EXCEPTION WITH RESUME

Posting Permissions

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