## Method __getitem__

### Use

__getitem__ is a method of the class SapDB_ResultSet.

With this method you position the cursor on a data record in the result set. You use this method to iterate, in a for loop, over all the data records in the result set.

### Features

__getitem__ (pos)

pos | Position of the data record pos=0: First data record in the :result set

Result:

● Data record at the specified position in the result set

● If the result set is empty/if pos exceeds the number of data records in the result set: None

### Example

You iterate across the entire result set with for. The system implicitly calls the __getitem__method and raises the value of the parameter pos in increments of 1 until the method triggers an exception.

for zip, name, state in session.sql ('SELECT * FROM hotel.city'):

print zip, name, state