IBM DB2 Manual page 148

Table of Contents

Advertisement

Table 20. sqlj.runtime.Scrollable methods for positioning a scrollable cursor
Method
first
last
previous
next
absolute(int n)
relative(int n)
afterLast
beforeFirst
Notes:
1. This method does not apply to connections to IBM Informix Dynamic Server.
2. If the cursor is after the last row of the result table, this method positions the cursor on
3. If the absolute value of n is greater than the number of rows in the result table, this
4. Suppose that m is the number of rows in the result table and x is the current row
Table 21. FETCH clauses for positioning a scrollable cursor
Method
FIRST
LAST
PRIOR
NEXT
ABSOLUTE(n)
132
Application Programming Guide and Reference for Java
a. Position the cursor using one of the methods listed in the following table.
1
1
1,2
1,3
1,4
1
1
the last row.
method positions the cursor after the last row if n is positive, or before the first row if n
is negative.
number in the result table. If n>0 and x+n>m, the iterator is positioned after the last row.
If n<0 and x+n<1, the iterator is positioned before the first row.
b. If you need to know the current cursor position, use the getRow, isFirst,
isLast, isBeforeFirst, or isAfterLast method to obtain this information.
If you need to know the current fetch direction, invoke the
getFetchDirection method.
c. Use accessor methods to retrieve the current row of the result table.
d. If update or delete operations by the iterator or by other means are visible
in the result table, invoke the getWarnings method to check whether the
current row is a hole.
For a positioned iterator, perform the following steps:
Use a FETCH statement with a fetch orientation clause to position the
a.
iterator and retrieve the current row of the result table. Table 21 lists the
clauses that you can use to position the cursor.
1
1
1,2
1,3
Positions the cursor
On the first row of the result table
On the last row of the result table
On the previous row of the result table
On the next row of the result table
If n>0, on row n of the result table. If n<0, and m is
the number of rows in the result table, on row m+n+1
of the result table.
If n>0, on the row that is n rows after the current row.
If n<0, on the row that is n rows before the current
row. If n=0, on the current row.
After the last row in the result table
Before the first row in the result table
Positions the cursor
On the first row of the result table
On the last row of the result table
On the previous row of the result table
On the next row of the result table
If n>0, on row n of the result table. If n<0, and m is
the number of rows in the result table, on row m+n+1
of the result table.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents