Subject FOR SELECT in SP's
Author Ryan Nilsson-Harding
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.

Rgds,
-Ryan