sql is a method of the SapDB_Session class (sdb.sql module) for executing SQL statements.
Syntax
sql (cmd)
Attribute |
Description |
---|---|
cmd |
SQL statement |
Successful execution: See Possible SQL Results
If an error occurs: Exception of the SQLError Class (sdb.sql Module)
You execute an SQL statement:
Syntax
cursor = session.sql ('SELECT * FROM hotel.room')
The cursor variable contains an object of the SapDB_ResultSet class (sdb.sql module). You can use this object to access the data records in the result set.
You execute a DELETE statement:
Syntax
rowsDeleted = session.sql ('DELETE FROM hotel.person WHERE name='NY'')
The rowsDeleted variable contains the number of lines deleted by the DELETE statement.
Example: Executing an SQL Statement and Reading the Result Set
Example: Executing an SQL Statement and Reading the Result Set with a For Loop
Example: Executing an SQL Statement and Querying Information About the Result Set
Example: Executing an SQL Statement Multiple Times with Different Values