Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bringing The records between ...

Status
Not open for further replies.

Hattusas

Programmer
Nov 11, 2001
344
TR
I want to upgrade my project into dynamic web pages.While getting database records I want to have perious, next links.I create them I won't have load all of the query.I can read the first 50 records for example,then the next page reads 51-100,the third 101-150 etc.

What I don't know if it is possible to read the records between n and m.
The first is very easy. I can type fetch first 50 rows only into my query.But what the others?Does anyone know a solution about this?

What is the syntax in DB2?Or I want to konw if it is possible?
Salih Sipahi
Software Engineer.
City of Istanbul Turkey
openyourmind77@yahoo.com
 
Hattusas,

this can be accomplished quite easily if you are using Version 7 of DB2. Version 7 allows "scrollable" cursors. I believe you are using Version 7 as you mention using "FETCH FIRST 50 ROWS ONLY".

DB2 Version 7 allows for ABSOLUTE cursor positioning. This will effectively move the cursor to an absolute position (a specific row relative to the top or bottom of the answer set depending on the plus or minus number). The absolute position can be specified by a constant or a host variable

It is also now possible to position the cursor using predicates such as FIRST,LAST,NEXT,PRIOR,AFTER,BEFORE and CURRENT.

The CURSOR can be defined as SENSITIVE or INSENSITIVE. If it is SENSITIVE it picks up DELETES and UPDATES(but not inserts) on the table you have declared the CURSOR against. If it is insensitive it works by creating a result set in a Temporary Global Table.

Scrollable Cursors use Temporary Global tables in the background so as a pre-requisite you must have a Tablespace/permission in your database for creating these.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top