ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → ABAP SQL → ABAP SQL - Overview → ABAP SQL - Table Buffering
Table Buffering - SQL Expressions
SQL expressions are usually evaluated on the database and and any built-in functions used as operands of these expressions are usually executed on the database too. If used, SQL expressions then bypass table buffering. The following expressions and functions, however, have an implementation in the table buffer and table buffering is not bypassed when they are used in reads (including nested reads).
- Numeric functions
ABS
,CEIL
,DIV
,FLOOR
, andMOD
- String functions
CONCAT
,CONCAT_WITH_SPACE
, andSUBSTRING
- Null value function
COALESCE (in the
SELECT
list only)
- Case distinctions (in the
SELECT
list only)
The expressions and functions can be used in both SELECT
lists and in WHERE
clauses.
If a catchable exception is raised when an SQL expression is evaluated in the table buffer, it is wrapped by the class CX_SY_OPEN_SQL_DB and can be handled using this class. The attribute PREVIOUS of the associated exception object is then given the name of the original exception class.
Other versions:
7.31 | 7.40 | 7.54
Notes
- When an SQL expression is evaluated in the table buffer, the same results are produced as on the database and not as in the corresponding ABAP evaluation. The following are some examples:
- Evaluations of the functions
DIV
andMOD
that are not the same as calculations with the identically named ABAP operators.
- Operands of the type SSTRING that do not have trailing blanks on the database, unlike in ABAP.
- Any null values produced
as results of nested expressions (for example in the
COALESCE
function or in comparisons) are handled as null values.
- The result of a relational expression with columns that contain
null
values is unknown, except in the case of the expression
IS [NOT] NULL
.
- If an SQL expression can be evaluated in the table buffer, any internal tables used as data sources of a query can also be evaluated on AS ABAP rather than their content having to be transported to the database. .