Subject Re: [IBO] FOR SELECT in SP's
Author Helen Borrie
At 11:37 PM 02-12-02 +0000, you wrote:
>Hi there,
>
>I'm trying to write my first multiple select SP, and having an
>issue, but I'm sure this is a simple problem. (I can get the SP to
>work using FB Workbench, but not using TIB_DSQL, hence asking here)
>
>The SP query is:
>
>RETURNS (PARTNUM VARCHAR(32))
>FOR SELECT PN FROM ORD_DET
>WHERE ORD_ID = :ord_id
>AND QTYREC < QTYORD
>INTO :PARTNUM
>DO
>SUSPEND;
>
>If I test this using FB Workbench, I get the results I am expecting,
>but when I use a TIB_DSQL component in my app, I'm getting errors.
>If the SP should return NO records, I get the error:
>"Attempt to fetch past last record in a record stream"
>
>and if the result set should contain records, I get the error:
>"Multiple rows in singleton select"
>But I thought using FOR SELECT DO allows for multiple selects.
>
>I'm sure this is simple, I'm just thrown because FB Workbench
>handles the SP correctly.

Yes, your problem is the choice of TIB_DSQL: it is not a dataset
component, so it cannot accept more than a single row. It's designed for
EXECUTING stuff. Use an IB_Query if you want a scrollable dataset, or
IB_Cursor if you don't need scrolling.

cheers,
Helen