The EGL get relative statement reads a numerically specified row in a relational-database result set. The row is identified in relation to the cursor position in the result set.
You can use this statement only if you specified the scroll option in the related open statement. The scroll option is available only if you are generating output in Java™.
If the value of position is positive, the position is an increment to the current numeric position in the result set. Specifying get relative 2 when the cursor is on the first row, for example, retrieves the third row; and specifying get relative 1 is equivalent to specifying get next.
If the value of position is negative, the position is a decrement to the current numeric position in the result set. Specifying get relative -2 when the cursor is on the third row, for example, retrieves the first row; and specifying get relative -1 is equivalent to specifying get previous.
A value of zero for position retrieves the row at the cursor position already in effect and is equivalent to specifying get current.
An SQL FETCH statement represents the EGL get relative statement in the generated code. The format of the generated SQL statement cannot be changed, except to set the INTO clause.
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 for EGL statements and commands
Related reference
delete
Exception handling
execute
get
get absolute
get current
get first
get last
get next
get previous
EGL statements
open
replace