User`s guide

6 Using Database Toolbox Functions
6-58
Importing Data Using a Scrollable Cursor
In this section...
“About Scrollable Cursors” on page 6-58
“Differences Between Native ODBC and JDBC Scrollable Cursors” on page 6-59
About Scrollable Cursors
A basic cursor lets you fetch the data in your SQL query sequentially. With a scrollable
cursor, you can fetch data sequentially or scroll up or down in the data without rerunning
the query. The cursor changes position based on an absolute or relative offset value.
Scrolling within the data offers advantages when you are working with a large data set.
This diagram shows the differences between the basic and scrollable cursors. Each
example in the diagram shows fetching data in the same table that contains 20,000
records.
As shown in Example 1, the basic cursor lets you fetch data sequentially. As shown
by Examples 2 through 6, the scrollable cursor lets you do this and fetch data from an
absolute or relative cursor position. Examples 3 and 4 use an absolute position offset and
Examples 5 and 6 use a relative position offset.
Scrollable cursors let you fetch data from a specific position. Example 3 fetches all
records starting from the absolute cursor position of 5000. Example 4 fetches 5000
records starting from the absolute cursor position of 5000.
Further, scrollable cursors let you fetch data relative to your current cursor position.
Assuming your current cursor position is 10,000, Example 5 fetches 3000 records using
a relative cursor position offset of -8000. A negative position offset moves the scrollable
cursor backwards in the data set. The fetch function adds -8000 to the current cursor
position of 10,000 to start fetching data from 2000. Assuming your cursor stays at the