Oracle 实现多行转换成一行 使用oracle 10g collect函数
来源:互联网 发布:与大数据相关的股票 编辑:程序博客网 时间:2024/06/06 00:35
在Oracle 10g中,新增加了一个聚合函数
注意:
collect:Takes a column of any type and creates a nested table of the input type out of the rows selected
1、创建数组类型
create or replace type varchar2_app as table of varchar2(2000);
2、创建format_string格式化输出函数
create or replace function format_string(v_table in varchar2_app) return varchar2 is Results varchar2(30000);begin for i in 1 .. v_table.count loop Results :=Results||','||v_table(i); end loop; --去掉第一个逗号-- return(substr(Results,2));end format_string;3、开始使用
select object_type, format_string(CAST(COLLECT(object_name) AS varchar2_app)) AS object_name from user_objects group by object_type;
注意:
COLLECT函数后要用类型varchar2_app数组类型
0 0
- Oracle 实现多行转换成一行 使用oracle 10g collect函数
- oracle 多行,一行转换(10g以上)
- oracle 11g 使用listagg函数合并多行为一行
- oracle--多行转为一行 (listagg函数)
- Oracle的bulk collect使用
- Oracle 10g 函数
- Oracle 10g 函数
- Oracle 10g中的转换函数与SQL单行函数
- oracle多行合并成一行自带函数
- Oracle 11G函数整理(转换函数)
- ORACLE实现多行合并一行
- oracle使用bulk collect insert实现大数据快速迁移
- oracle 10g+ 行列转换
- Oracle函数,把十进制color转换成 R,G,B
- Oracle 11g使用Pivot函数实现数据聚合行转列
- oracle一行数据转换成多行数据
- Oracle 10g 分析函数
- oracle 10g SQL函数
- 为apache2.2.26启用deflate压缩
- 前序和中序构造树的递归实现
- Android NDK开发(五)——C代码回调Java代码
- 大型软件的共享基础团队
- android bitmap config
- Oracle 实现多行转换成一行 使用oracle 10g collect函数
- 更新Linux内核头文件(linux headers)
- 亲测Android wifi状态三种广播
- HDU—— 2057 A + B Again
- Mysql MYISAM存储引擎 数据存储结构
- java 把一个list中的数据按照树结构排序
- AsyncTask的用法
- APK改之理使用技巧
- 姐弟恋,是否要继续下去?