Entering content frame

Background documentation Method sqlX Locate the document in its SAP Library structure

Definition

sqlX (cmd parms = [])

Use

sqlX is a method of the class SapDB_Session. When this method is called, the SQL statement cmd is executed.

The SQL statement cmd can contain the placeholders ? or :<varname> for parameters that the system replaces with values from the parameter list .

The method sqlX enables you to execute SQL statements with parameters, without requiring you to create an object of the class SapDB_Prepared first.

Result

The type of the result depends on the content of the SQL statement (see Possible SQL Results).

Example

Executing a data query (for example, SELECT statement)

cursor = session.sql ('SELECT * FROM messages WHERE msgno>?',[0])

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

 

Executing a data manipulation action (for example, a DELETE statement)

rowsDeleted = session.sql ('DELETE FROM testtable WHERE column = ?', [3])

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

 

Leaving content frame