Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Informix
Expertise: Beginner
Jul 17, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Cursors in Informix

What is the purpose of using the fetch and declare cursor in Informix.4GL? How do you use the scroll cursor, and what are its advantages?

Cursors allow you to handle result sets that contain more than one row of results.

The scroll cursor is a cursor that "remembers" where you are in the cursor. Usually, every time you open up a cursor, it starts from the beginning. For example, if you had user numbers running from 1 to 10, opening a cursor on a statement like "SELECT * from my_table order by user_number" you would always start with user number 1.

With a scroll cursor, when you open it the first number will be user 1. As you often do with cursors, you do something with the data and then go back to get more data. When you go to the scroll cursor after doing something with user 1 and then do a fetch from the cursor a second time, you will get user 2, and so on.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date