Subject Re: [IBO] using tib_storedProc
Author Helen Borrie
At 02:13 PM 09-09-01 +0000, you wrote:
>Help please!
> on how to drive a stored proc to produce a dataset.
>I have written a stored procedure which ends as
>"
> result = A - B;
> suspend;
> end
>"
>which seems to work while testing
>
>In the calling program I put
> mystoredproc.prepare;
> mystoredproc.parambyname(...) := etc
>
> MyStoredProc.open
> while not mystoredproc.eof do
> begin
> do something;
> end;
>
>But does the stored proc produce an eof ?
>
>When I say OPen it seems to be getting the whole dataset before I can
>catch it !
>
>SO I tried
> while not myanswer = null do
> mystoredproc.execute;
> myanswer := mystoredproc.result;
>That does not seem to work either
>
>will happily post the stored proc and the little test program if it
>helps.

Before you do, read this (from the Help file):
StoredProcForSelect
If the stored procedure is for the purpose of selecting multiple records or for selecting a single record where the SUSPEND statement has been used in the stored procedure then set this property to true.
Applies to
TIB_StoredProc
Declaration
Property StoredProcForSelect : boolean Read FStoredProcForSelect Write SetStoredProcForSelect Default false;
Description
Then, use this just like you would an IB_Cursor to navigate through the records in a unidirectional fashion.

NB you can also bring a selectable stored procedure's output into a TIB_Cursor or TIB_Query. The SQL property is then:

select <field list> from MyProc(:param1, :param2....)

hth

Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________