Function documentationrelative Method (SapDB_ResultSet Class) Locate this document in the navigation structure

 

relative is a method of the SapDB_ResultSet class (sdb.sql module). You can use this method to position the cursor on a data record relative to the current one in the result set.

Features

Syntax Syntax

  1. relative (offset)
End of the code.

Attribute

Description

offset

Number of data records that the cursor should be moved back or forward, relative to the current position

offset > 0: You move the cursor forward in the result set

offset < 0: You move the cursor backward in the result set

Result
  • Data record at the specified position in the result set

  • If the result set is empty or if offset is greater than the number of data records after or before the current cursor position: None

Example

  • You move the cursor 5 data records forward:

    Syntax Syntax

    1. row = cursor.relative (5)
    End of the code.
  • You move the cursor 1 data record backward:

    Syntax Syntax

    1. row = cursor.relative (-1)
    End of the code.

    This expression is equivalent to

    Syntax Syntax

    1. row = cursor.previous ()
    End of the code.
  • Example: Executing an SQL Statement and Navigating in the Result Set