|Subject||Re: [IBO] Returning value from SP|
>>Create procedure SingleLineHelen, this is not true - in FB 1.5.0 at least.
>>Returns (a integer)
>>a = 1;
>>a = 2;
> Currently (with the bug) it would return 1. You can only get
> multi-row output from a cursor. There is no cursor here, so
> there is nothing to wait for. Suspend just drops control
> down to the final END statement: the second assignment is
> never executed.
CREATE PROCEDURE TEST_SUSPEND
RETURNS ( A INTEGER )
A = 1;
A = 2;
INSERT INTO TABLE1 (PK) VALUES(:A);
SELECT * FROM TEST_SUSPEND
produces 1 row (as expected from the single suspend)
the insert does create a row with PK=2 (is executed)
This is as described in the IB6 doco. SUSPEND suspends
operation until the next fetch, then execution proceeds
from the next statement.
I would not expect it to return 2 unless I placed another
SUSPEND command at the end. EXIT/END is not the same as
SUSPEND. To do so would be likely to break existing code,
since it would imply that every procedure using SUSPEND
would always return an additional entry.
At this point I cannot see anything out of place from
what I expect of SUSPEND.