Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

Cursors in Informix

Question:
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?

Answer:
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.

 

 

Sitemap