首页 > 数据库技术 > 详细

SQL LISTAGG 合并行

时间:2019-07-09 16:45:42      阅读:92      评论:0      收藏:0      [点我收藏+]

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.

对于指定的度量, LISTAGGORDER  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.

SQL LISTAGG 合并行

原文:https://www.cnblogs.com/zhaochunyi/p/11158042.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!