Method sql

Use

sql is a method of the class SapDB_Session.

With this method you execute an SQL statement.

Features

sql (cmd)

cmd

SQL statement

Result:

?     Successful execution: see Possible SQL Results

?     Error: exception of the class SQLError

Example

?     You execute an SQL statement:

cursor = session.sql ('SELECT * FROM hotel.room')

The variable cursor contains an object of the class SapDB_ResultSet. You can use this object to access the data records of the result set.

?     You execute a DELETE statement:

rowsDeleted = session.sql ('DELETE FROM hotel.person WHERE name='NY'')

The variable rowsDeleted contains the number of lines deleted by the DELETE statement.

?     Executing an SQL Statement and Reading the Result Set

?     Executing an SQL Statement and Reading the Result Set with a For Loop

?     Executing SQL Statements and Querying Information About the Result Set

?     Executing an SQL Statement Multiple Times with Different Values