Ansicht
Dokumentation
ABENABAP_SQL_NULL_VALUES - ABAP SQL NULL VALUES
Vendor Master (General Section) rdisp/max_wprun_time - Maximum work process run timeThis documentation is copyright by SAP AG.
- Null Values
A null value is a special value returned by a database in order to indicate an undefined value or result. Null values do not correspond to any content of data objects in ABAP. Especially, a null value is not the same as a type-dependent initial value.
In , null values can be handled
- using the condition IS NULL,
- a null indicator, or
- the function coalesce.
statements for write access generally do not create null values, except when processing views that do not cover all columns of a database column.
As values of database fields, null values might occur in the following situations:
- Depending on the database system, empty strings can also be represented by null values.
- Null values can be produced in DDIC database tables if new columns are appended to filled tables.
In read accesses with the statement SELECT, null values can be produced by
- in outer joins,
- in SQL expressions,
- when CDS views containing such constructs are accessed.
When they are passed to data objects, they are transformed to type-dependent initial values. However, in the additions GROUP BY and ORDER BY, in table buffering, and when using internal tables as data sources, null values are handled as such. A null indicator of a structured target area of a query can show which columns of the result set contain null values and which do not.
Notes
- When subqueries are inserted using INSERT or MODIFY, null values are also transformed to type-dependent initial values or raise an exception after an attempt to set a key field to the null value.
- In Native SQL and AMDP, null values passed to ABAP objects are also transformed to their type-dependent initial values.
- It is, by principle, not possible to insert null values in key fields of DDIC database tables. If an attempt is made, this raises an exception on the database.
- In the ABAP Dictionary, a flag for initial values can be set when inserting new columns in existing DDIC database tables to preserve the type-dependent initial value instead of the null value.
Example
In the following example, the condition IS NULL is true because the CASE expression on the left side does not find a true WHEN condition and does not have an ELSE branch.
CPI1466 during Backup CPI1466 during Backup
This documentation is copyright by SAP AG.
Length: 5039 Date: 20240419 Time: 111043 sap01-206 ( 55 ms )