Progress
DataServer for
Microsoft SQL Server
Guide


Handling Errors from Stored Procedures

The RUN STORED–PROC statement supports the NO–ERROR option. The following example shows how to trap errors within a procedure:

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. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095