"Roman" <rg*******@hotmail.comwrote in message
news:08**********************************@y5g2000h sf.googlegroups.com...
DB version - DB2 9.1 on AIX
Consider the following script construct...
open curs1;
fetch curs1 into a, b;
while ( a 0)
begin
set a = -1;
fetch curs1 in to a, b;
end while;
What happens when an end of table is reached? Does a remain -1? If
not, what will it be?
Thanks in advance
Since you did not include the declare cursor, I am not 100% sure how many
columns you have in the fetch.
DB2 will return an SQLCODE 100 when it reaches the end of cursor on a fetch.
Usually, most people handle that with condition handler that sets a variable
to a certain value when the end of cursor (row not found) condition is
reached.