Subject | Re: [ib-support] Suspend in stored procedures |
---|---|
Author | Paul Reeves |
Post date | 2001-10-28T07:31:20Z |
Solon Edmunds wrote:
found a need for the former, which don't use 'suspend' and don't even need
'exit' although it is good practice to specify the exit point.
it will literally suspend operation, returning the values currently in the
returns params. It then continues execution. Suspend is typically used with a
For Select loop to iterate through each row of a result set, return a row on
each suspend. Such a procedure is selectable and called with 'Select blah from
myproc(x,y,z)', rather than 'execute myproc(x,y,z)'.
Selectable stored procedures allow you to do server side computations on
datasets, to join datasets in ways that may otherwise be tricky with SQL
and/or simplify the security model by allowing users access to an SP but not
an underlying table.
You really need to dig out the Language Reference - it is all explained in
there.
Paul
--
Paul Reeves
http://www.ibphoenix.com
taking InterBase further
>Not necessarily.
> I've noticed that suspend should be put at the end of stored
> procedures..
> And that my stored procedures don't have it, but appear to work fineThere are two types of SP - executable and select. You have probably only
> (ib6.01)
found a need for the former, which don't use 'suspend' and don't even need
'exit' although it is good practice to specify the exit point.
> What effect could not putting suspend in stored procedures have?Perhaps that question should be inverted. If you put suspend in the procedure
it will literally suspend operation, returning the values currently in the
returns params. It then continues execution. Suspend is typically used with a
For Select loop to iterate through each row of a result set, return a row on
each suspend. Such a procedure is selectable and called with 'Select blah from
myproc(x,y,z)', rather than 'execute myproc(x,y,z)'.
Selectable stored procedures allow you to do server side computations on
datasets, to join datasets in ways that may otherwise be tricky with SQL
and/or simplify the security model by allowing users access to an SP but not
an underlying table.
You really need to dig out the Language Reference - it is all explained in
there.
Paul
--
Paul Reeves
http://www.ibphoenix.com
taking InterBase further