ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → Native SQL → ADBC - ABAP Database Connectivity
ADBC - CL_SQL_STATEMENT
The class CL_SQL_STATEMENT contains instance methods that receive and execute dynamically created SQL statements.
Instances of the class CL_SQL_STATEMENT can be created using the statement
CREATE OBJECT
or the instance operator NEW
, which allow a reference to an object of the class
CL_SQL_CONNECTION to be passed to the constructor. If no database connection is passed, the
standard connection from the database interface to the
standard AS ABAP database is used.
Other versions: 7.31 | 7.40 | 7.54
Notes
- Exactly one SQL statement can be passed to each method of the class CL_SQL_STATEMENT to be executed. Passing multiple SQL statements separated by delimiters such as ; is not possible.
- The class CL_SQL_STATEMENT allows the statement passed to be executed once. The subclass CL_SQL_PREPARED_STATEMENT can be used to execute a statement multiple times with different parameters.
- An object of the class CL_SQL_STATEMENT is often only intended to be used once, which means it is
also only addressed once. In this case, the instance operator
NEW
with appended method call can be used to create the instance. This removes the need to declare a reference variable explicitly.
- The methods in the class CL_SQL_STATEMENT should not be used to execute transaction-control statements
(
COMMIT
,ROLLBACK
). This is because they are not detected by the database interface, which then might not execute the actions required at the end of a transaction. Only the appropriate methods in the class CL_SQL_CONNECTION can be used for transaction control.