Subject RE: [ib-support] SUSPEND - Was: problem with very simple Stored Procedure
Author Alan McDonald
Artur,
At the risk of going over old ground (I haven;t seen all the response to
which you refer) I think there must be some confustion over
1 - "an executable procedure"
2 - "a select procedure"

The example following may help

CREATE PROCEDURE P RETURNS (R INTEGER)
AS BEGIN
R = 0
WHILE (R<5) DO BEGIN
R = R +1;
SUSPEND;
IF (R = 3) THEN
EXIT;
END
END;

If this is used as a select procedure (Select * from P)
then it will return 1, 2 and 3 since SUSPEND will keep returning R until
R=3 when the EXIT terminates the procedure

If this is used as an executable procedure (Execute procedure P)
then it will retutn 1 since SUSPEND will terminate the procedure and return
the current value of R

When I(you) use SELECT as in your "problem" procedure I need to have
SUSPEND, if you want to use EXECUTE, then you must use EXIT. Those are the
rules, but since you only have one value to return, then either SUSPEND or
EXIT will do th job but it would always be best to follow these rules. i.e.
use one or the other but don't not use one of them.

Hope this helps
Alan



-----Original Message-----
From: Artur Anjos [mailto:arsoft@...]
Sent: Tuesday, 27 August 2002 23:06
To: ib-support@yahoogroups.com
Subject: [ib-support] SUSPEND - Was: problem with very simple Stored
Procedure


Hi

> you should always have the suspend; (...)

I have seen over the times a lot of discussion about this. Really, I don't
understand why we must use the suspend if the SP is called by EXECUTE, not
by SELECT.

For now, I'm using SUSPEND when I need to, and never use it when I use
EXECUTE to run the SP. Just like in the documentation :-). No problems at
all.

Is there any logical explanation about this so aready discussed subject? I
have seen so many posts about it, but no conclusion at all.

Artur






Yahoo! Groups Sponsor
ADVERTISEMENT



To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



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