Subject | Question about Select in DSQL |
---|---|
Author | Joe Martinez |
Post date | 2002-11-07T11:45:59Z |
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
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