Subject Re: Select works but same in SP does not
Author Adam
--- In firebird-support@yahoogroups.com, Mark Deibert
<mark.deibert@g...> wrote:
> Ok, you're right that fixed it!
> So should I -always- include the For-Do in Select SPs just in case
it
> returns more than one?

Every time you call suspend, it um suspends, which allows the calling
thread to grab a record. In your first example, you were only calling
suspend once, so even though every record was retrieved within the
SP, you were only calling it for the last record.

But the logic is a bit reversed.

There should be no such thing as just in case.

Either a query

1) Can return multiple values
2) Can only return single value

So if it is at all possible to get multiple rows, then you should
either wrap it inside a for do loop, or add a "first 1" to the query
to ensure that it only returns a single value.

Adam