Subject Re: [ib-support] Can SLCODE 100 be trapped in an SP?
Author Ivan Prenosil
> From: Bill Katelis
> Can SQLCODE 100 be trapped in an SP as follows ...
>
> WHEN SQLCODE 100 DO
> BEGIN
> ........
> END
>
> if so - I can't get it to work...

In documentation you can find this table:
SQLCODE Message Meaning
< 0 SQLERROR Error occurred. Statement did not execute.
0 SUCCESS Successful execution.
+1-99 SQLWARNING System warning or informational message.
+100 NOT FOUND End of current active set of rows reached.

WHEN is "error handling statement", i.e. it is meant to trap _errors_.
It does not trap warnings, nor not found condition.

It would also make no sense to break the sequence of statments
and jump to WHEN at the end of the block after each select.
FOR SELECT in pseudo code looks like this
EXECUTE SELECT
WHILE (100 <> FETCH()) DO ...;
i.e. each select is eventually ended by SQLCODE 100.

Even if the select does not return any rows, it is not considered error.
Or do you think that this Pascal command should raise exception ? :-)
FOR I:=2 TO 1 DO ...

Ivan
http://www.volny.cz/iprenosil/interbase