Consultor Eletrônico



Kbase P6592: How to get a error from a stored procedure using Dataservers
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   18/03/2010
Status: Verified

GOAL:

How to get a error from a stored procedure using Dataservers

GOAL:

How to trap stored procedure error with MS SQL DataServer

GOAL:

Sample code on how to use NO-ERROR and ERROR-STATUS with STORAGE PROCEDURE


FACT(s) (Environment):

All Supported Operating Systems
Progress/OpenEdge Product Family
DataServers

FIX:

Run stored-proc NO-ERROR then check ERROR-STATUS.

See example below:

DEFINE VAR j AS INTEGER.

RUN STORED-PROC send-sql-statement NO-ERROR

("select count (*) from xxx.customer where name between 'A' and 'Z' ").

IF ERROR-STATUS:ERROR THEN DO:

DO j = 1 TO ERROR-STATUS:NUM-MESSAGES:

MESSAGE "error" ERROR-STATUS:GET-NUMBER(j)

ERROR-STATUS:GET-MESSAGE(j).

END.

END.

CLOSE STORED-PROC send-sql-statement.