ABAP SELECT [DISTINCT]

来源:互联网 发布:余额宝怎么样知乎 编辑:程序博客网 时间:2024/04/29 20:30

... [DISTINCT] { }

Effect

If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.

If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:

  • If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
  • If the system tries to access pool or cluster tables and single columns are specified in columns.

Notes

When specifying DISTINCT, note that this requires the execution of sort operations in the database system, and the SELECT statement therefore bypasses the SAP buffer.


原创粉丝点击