Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011
    Posts
    1

    Unanswered: Sybase IQ error handling - please help

    Hi All,

    I am using sybase iq 15.1 and i am new to this. I have a problem in capturing the return code of the procedure.

    I have a main sp which calls another sp. I am not able to capture the return code of the second sp.

    sample code.

    create procedure main
    as
    begin
    declare @rc int
    ....
    ....
    execute sub_proc @var1 @var2
    set @rc = @@error
    if @rc != 0
    print 'Faied'

    end

    The second proc is throwing error
    sql anywhere error -638: right truncation of string data.

    Please adviced how to capture this error in main proc and return the message.
    Thanks in advance.

    Deepak

  2. #2
    Join Date
    May 2008
    Posts
    35
    Your called procedure should have a return condition.

    Code:
    RETURN @@error
    And then while calling the proc

    Code:
    EXEC @error = CalledProc @param1 , @param1
    Then check against @error

Posting Permissions

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