Subject | Re: [IBO] Stored procedure, ExecSQL and Suspend |
---|---|
Author | Lele Gaifax |
Post date | 2002-11-04T16:23:33Z |
>>>>> On Mon, 4 Nov 2002 16:34:48 +0100 (MET), Paul Vinkenoog <paulvink@...> said:PV> I have several SP's that do a singleton SELECT into the return
PV> variables, without SUSPEND, and they've been working fine
PV> since more than a year.
Yup, this surprises me, even more the fact that neither your example,
nor my even simpler one
CREATE PROCEDURE test$suspend RETURNS (a INTEGER, b VARCHAR(10)) AS
BEGIN
a = 1;
b = 'lele';
END
work as you state. I executed a "SELECT * FROM test$suspend" in a
IB_DSQL, and it correctly (from my POW) returns an empty dataset.
Adding the required (as far I understand the docs) SUSPEND makes it
working as expected.
So, what is going on here?
PV> Also, the Data Definition Guide, on page 153, states that
PV> SUSPEND in an executable procedure jumps to the final END
PV> statement, but that it is not recommended.
I'll go and check, but if this is what it says, I consider it either
wrong or misleading: the SUSPEND *do*not* jump anyware, it simply
suspend the execution of the SP, returns the value, and then the
control returns to the next instruction, that is the one that follows
the SUSPEND statement.
PV> In an executable procedure, it's the final END that returns
PV> the values to the caller. In a selectable procedure (with FOR
PV> SELECT ... DO), SUSPEND returns values but END doesn't.
That's not what it seems to me, and I'm not able to reproduce your
case.
Some clarification by FB gurus seems needed...
bye, lele.
--
nickname: Lele Gaifax | Quando vivro' di quello che ho pensato ieri
real: Emanuele Gaifas | comincero' ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.