Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP - Database Accesses →  ADBC - ABAP Database Connectivity 

CL_SQL_STATEMENT - Prepared SQL Statements

Class CL_SQL_PREPARED_STATEMENT is a subclass of CL_SQL_STATEMENT. It makes it possible to execute several times with different parameters an SQL statement that was passed to it.

For this purpose, the instance constructor contains an obligatory input parameter STATEMENT of type string that must be passed to a syntactically correct SQL statement. The SQL statement can contain placeholder ?, as is the case with the methods of CL_SQL_STATEMENT.

Using the methods inherited from CL_SQL_STATEMENT, the placeholders can be linked to parameters and the instantiated SQL statement can be executed. In doing so, the SQL statement is not passed to the corresponding method.

After the work process has been switched (see implicit database commit), a prepared statement can no longer be used.

If a prepared statement is no longer needed, it should be closed using instance method close so that all resources that are needed in the database are released.

Other versions: 7.31 | 7.40 | 7.54