I made a file with pictures and its working like a photo gallery. So, when I go back with F12 I want to see the prior record in the file.
If the cursor is reaching the first record of the file, the program should be closed.
Actually it is going round in a circle, it's loading the prior record and never leaves the loop.
How can tell the program to stop after the first record of a file?
Here's my SQL:
EXEC SQL
DECLARE C1 SCROLL CURSOR FOR SELECT * FROM FILE
WHERE [variables].....
ORDER BY ....
FOR FETCH ONLY;
EXEC SQL
OPEN JCBBC1;
EXEC SQL
FETCH NEXT FROM C1 INTO :FILE;
DOW SQLCOD = *ZERO;
*do something....*
IF F12 is pressed;
EXEC SQL
FETCH PRIOR FROM C1 INTO :FILE;
ENDDO;
ROW_NUMBER() is a function that generates a psuedo-column containing consecutive numbers starting from 1 and counting up for each row of returned results (hence the name of ROW_NUMBER()).