get absolute

The EGL get absolute statement reads a numerically specified row in a relational-database result set. The row is identified in relation either to the beginning of the result set (if you specify a positive value) or to the end of the result set (if you specify a negative value).

You can use this statement only if you specified the scroll option in the related open statement.


Syntax diagram for the get absolute statement

position

An integer item or literal.

If the value of position is positive, the row is identified in relation to the beginning of the result set. Specifying get absolute 1, for example, retrieves the first row and is equivalent to specifying get first. Specifying get absolute 2 retrieves the second row.

If the value of position is negative, the row is identified in relation to the end of the result set. Specifying get absolute -1, for example, retrieves the last row and is equivalent to specifying get last. Specifying get absolute -2 retrieves the second to last row.

A value of zero for position causes a hard error, as described in Exception handling.

record name

Name of an SQL record.

from resultSetID

An ID that ties the get absolute statement to an open statement run earlier in the same program. For details, see resultSetID.

into

Begins an EGL into clause, which lists the items that receive values from a relational-database table.

item

An item that receives the value of a particular column. Do not precede the item name with a colon (:).

If you issue a get absolute statement to retrieve a row that was selected by an open statement that has the forUpdate option, you can do any of these:

An SQL FETCH statement represents the EGL get absolute statement in the generated code. The format of the generated SQL statement cannot be changed, except to set the INTO clause.

If you issue a get absolute statement that attempts to access a row that is not in the result set, the EGL run time acts as follows:

In general, if an error occurs and processing continues, the cursor remains open, with the cursor position unchanged.

Finally, when you specify SQL COMMIT or sysLib.commit, your code retains position in the cursor that was declared in the open statement, but only if you use the hold option in the open statement.

Related concepts
resultSetID
SQL support

Related tasks
Syntax diagram

Related reference
delete
Exception handling
execute
get
get current
get first
get last
get next
get previous
get relative
EGL statements
open
replace