Entering content frame

Function documentation Method sqlX Locate the document in the library structure

Use

sqlX is a method of the class SapDB_Session.

With this method you execute an SQL statement with parameters without first having to create an object of the class SapDB_Prepared.

Features

sqlX (cmd, parms = [])

 

cmd

SQL statement; can contain the following placeholders:

? | :<varname>

parms

Parameter list from which the system replaces the placeholders for parameters

 

Result:

     Successful execution: see Possible SQL Results

     Error: exception of the class SQLError

Example

     You execute a SELECT statement that contains a parameter:

cursor = session.sqlX ('SELECT firstname, name, cno FROM hotel.customer WHERE cno>?',[3000])

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 that contains a parameter:

rowsDeleted = session.sqlX ('DELETE FROM hotel.person WHERE name = ?',['NY'])

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

 

Leaving content frame