question

qgenesist avatar image
qgenesist asked

is cursor position defined on a miss?

my programming has been on iSeries using RPG.  I am trying to mimic the behavior of test for the existence of a key in the table, 
(in RPG this would set the cursor at; or at the next record to the key I want) if the key is found, I can do a read (select) from there; 
if the key is not found, I want to position to the record (row) prior to where the key should be and read (select) from there. 
so... I would: SELECT EXISTS(SELECT * FROM table1 WHERE ...) I will have a record or not, if not, how do I get the record that is just prior to the one I want that does not exist?

(I am on MySQL 8.0 and Windows 7 64 bit if it is important) <br>
cursorprogrammingtestrecord
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.