Subject Re: [IBO] Question about Select in DSQL
Author Jason Wharton
When fetching from a DSQL you will get an error if there is any number of
records other than one.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --


----- Original Message -----
From: "Joe Martinez" <joe@...>
To: "IB Objects" <IBObjects@yahoogroups.com>
Sent: Thursday, November 07, 2002 4:45 AM
Subject: [IBO] Question about Select in DSQL


> I'm trying to do a parameterized select of a single value with a DSQL
object.
>
> If the select returns zero rows (instead of one), I get an error that
says,
> "attempt to fetch past the last record in a record stream".
>
> Is this normal, or am I doing something wrong?
>
> Here's what I'm trying to accomplish. I want to do the select on a single
> column (the key). I want to know, first of all, if the key exists, and
> second, if it DOES exist, the value of a particular column. For example:
>
> select COL2 from mytable where COL1 = somevalue
>
> I want to know whether somevalue exists in the table, and if so, what the
> value of COL2 is for that row.
>
> Do I have to break it into two separate statements (a count to see if it
> exists, and then my above select to get the value), or is it possible with
> a single DSQL fetch? I know I can do this with a regular query. The
> statement always succeeds, even if it returns no rows, and I can just
check
> the EOF property to see if it returned a row or not. But I want to use
> DSQL for the best performance.
>
> Thanks,
> Joe