On Mon, Jun 12, 2006 at 11:14:24PM -0400, Peter L. Berghold wrote:
> what I don't see is how to detect that I've fetched the last row from a
> query. Is there more complete doco on this process somewhere?
You could either handle a NOT FOUND exception, or make use of SQLCODE or
SQLSTATE like this...
EXEC SQL DECLARE csr_fred CURSOR FOR SELECT....
EXEC SQL OPEN csr_fred;
while (SQLCODE == 0) {
EXEC SQL FETCH csr_fred INTO :jim, :sheila,...
if (SQLCODE == 0) {
....
body of row processing here
....
}
}
EXEC SQL CLOSE csr_fred;