Subject RE: [ib-support] How Does SQLERROR work in a Stored Procedure
Author Martijn Tonies
Hi,

Language Reference, chapter 3, Procedures and Triggers:

WHEN...DO

'If used, WHEN must be the last statement in a BEGIN...END block.
It should come after SUSPEND, if present.'

There's an example on how to use in the same part of the reference.

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com



===
I have tried various methods using SQLERROR and SQLCODE but get error
messages such as

Dynamic SQL Error
SQL error code = -104
Token unknown - line 7, char 12
SQLERROR
Statement: CREATE PROCEDURE PARTNO_INSERT

when trying to compile the following sp

CREATE PROCEDURE PARTNO_INSERT
(
PART_NMBR CHAR(16) /* New Part # */
)
AS
Begin /* Partno is Unique
- Index exists and works ok */
Whenever SQLERROR Do /* If any error */
Exception InsertPart; /* Display my own message */
Insert into Partnos(Partno) /* Create New Part */
Values (:Part_Nmbr); /* New Part # */
end
===


[Non-text portions of this message have been removed]