LISTAGG
Syntax 语法
listagg_overflow_clause::=
Purpose
For a specified measure, LISTAGG orders data within each group specified in the ORDER BY clause and then concatenates the values of the measure column.
对于指定的度量, LISTAGG对ORDER BY 子句中指定的每个组中的数据排序,然后连接度量列的值。
• As a single-set aggregate function, LISTAGG operates on all rows and returns a single output row.
• 作为单个集合聚合函数,LISTAGG对所有行进行操作并返回单个输出行。
• As a group-set aggregate, the function operates on and returns an output row for each group defined by the GROUP BY clause.
• 作为组集聚合,函数对由group by子句定义的每个组进行操作并返回一个输出行。
• As an analytic function, LISTAGG partitions the query result set into groups based on one or more expression in the query_partition_clause.
• 作为一个分析函数,LISTAGG根据query_partition_clause中的一个或多个表达式将查询结果集划分为多个组。
The arguments to the function are subject to the following rules:
函数的参数受以下规则约束:
• The ALL keyword is optional and is provided for semantic clarity.
• ALL关键字是可选的,用于语义清晰。
• The measure_expr is the measure column and can be any expression. Null values in the measure column are ignored.
• 度量表达式是度量列,可以是任何表达式。忽略度量列中的空值。
• The delimiter designates the string that is to separate the measure column values. This clause is optional and defaults to NULL.
If measure_expr is of type RAW, then the delimiter must be of type RAW. You can achieve this by specifying the delimiter as a character string that can be implicitly converted to RAW, or by explicitly converting the delimiter to RAW, for example, using the UTL_RAW.CAST_TO_RAW function.
• The order_by_clause determines the order in which the concatenated values are returned. The function is deterministic only if the ORDER BY column list achieved unique ordering.
• As a group-set aggregate, the function operates on and returns an output row foreach group defined by the GROUP BY clause.
原文:https://www.cnblogs.com/zhaochunyi/p/11158042.html