Capturing ERRORCODE in BTEQ from stored Procedure

Database
Enthusiast

Capturing ERRORCODE in BTEQ from stored Procedure

I am new to stored procedure. We might need to capture error code from store procedure in bteq to take decision based on success/failure of stored procedure.How can I return ERRORCODE from store procedure? I would like to use BTEQ syntax .IF ERRORCODE <> 0 to take decision based on stored procedure success/failure.
2 REPLIES
Enthusiast

Re: Capturing ERRORCODE in BTEQ from stored Procedure

if no error capturing routine specified in the store procedure, the error code will be returned by default in store procedure.
Not applicable

Re: Capturing ERRORCODE in BTEQ from stored Procedure

Hi,

 i have the same problem but can solve it. The stored procedure returns an error code but is not captured by Bteq, here is an example log:

Call SP_NAME('DB_NAME','TABLE_NAME');

 *** Error 2825 NO RECORD OF THE LAST REQUEST WAS FOUND AFTER DBC RESTART

 *** Total elapsed time was 32 minutes and 45 seconds.

+---------+---------+---------+---------+---------+---------+---------+----

.IF ERRORCODE <> 0 THEN .GOTO BTEQ_KO ;

The Bteq ERRORCODE is always 0, the Bteq doesn't see the all Stored Procedure errorcode and BTEQ go to a OK state.

There's some other sql instruction for capture the SP error code in a Bteq?

Regards.

Giulian