Michael:
 
You can use the PRINT and RAISE ERROR as shown in the sample
procedure shown below.
 
Please note that errors #7000-7999 are reserved for application
specific errors in ALLBASE. You should use this error range to
prevent confusion with errors from other sources. PRINT does
exactly what it says, it places a message in the message buffer.
RAISE ERROR does that plus returns an error condition that prevents
further execution.
 
Hope this helps
 
 
Gary L. Biggs
 
Sample courtesy of Doug Myers:
 
CREATE PROCEDURE PURCHDB.CHECK_ORDERITEM (ORDERNUMBER INTEGER NOT NULL,
  VENDPARTNUMBER CHAR(16) NOT NULL) AS
BEGIN
DECLARE VENDORNUMBER INTEGER;
DECLARE NUMROWS INTEGER;
SELECT VENDORNUMBER INTO :VENDORNUMBER FROM PURCHDB.ORDERS WHERE
  ORDERNUMBER = :ORDERNUMBER;
IF ::SQLCODE = 100 THEN
  RAISE ERROR 7001 MESSAGE 'Invalid ORDERNUMBER';
ELSEIF ::SQLCODE <> 0 THEN
  PRINT 'ERROR CODE:';
  PRINT ::SQLCODE;
  RAISE ERROR 7000 MESSAGE 'Error accessing PURCHDB.ORDERS';
ELSE
  SELECT COUNT(*) INTO :NUMROWS FROM PURCHDB.SUPPLYPRICE
    WHERE VENDORNUMBER = :VENDORNUMBER AND VENDPARTNUMBER = :VENDPARTNUMBER;
  IF ::SQLCODE <> 0 THEN
  PRINT 'ERROR CODE:';
    PRINT ::SQLCODE;
        RAISE ERROR 7000 MESSAGE 'Error accessing PURCHDB.SUPPLYPRICE';
  ELSEIF :NUMROWS = 0 THEN
       RAISE ERROR 7002 MESSAGE 'Invalid VENDPARTNUMBER';
  ENDIF;
ENDIF;
END;
On Wed, 7 Aug 1996 18:25:01 +0200  Michael Holzer wrote:
 
>Has someone experience with debugging errors in stored procedures
>that are executed from ISQL?
>How to code that errors result in termination of script and give
>meaningful error messages to diagnose the problem!
>
>example:
>isql> execute procedure do_something;
>
>in case of error display something like:
>
>Error: Can't delete Order: 123
>Error: SQLCODE: 456
>
>Regards,
>Michael Holzer
>HP BBN
>
>PS: The manuals ISQL/SQL Reference are not helpful in this area.