发布网友 发布时间:2022-04-29 19:22
共2个回答
懂视网 时间:2022-04-29 23:43
Cause: java.sql.SQLSyntaxErrorException: ORA-01790: 表达式必须具有与对应表达式相同的数据类型
2.不同版本直接进行比较
2.1 10g测试如下
SELECT*FROM V$VERSION;
SELECT WM_CONCAT(T.DNAME) FROM DEPT T
2.2 11g测试如下:
3.修复方法《使用TO_CHAR函数进行转换》
SELECT TO_CHAR(WM_CONCAT(T.DNAME)) FROM DEPT T; SELECT TO_CHAR(SUBSTR(WM_CONCAT(T.DNAME),1,2000)) FROM DEPT T;
本文出自 “我的技术博客” 博客,请务必保留此出处http://programmer.blog.51cto.com/2859493/1653114
Oracle函数之单列合并函数WM_CONCAT问题记录
标签:oracle wm_concat
热心网友 时间:2022-04-29 20:51
insert into test values('aaa','1'); WM_CONCAT(A) WM_CONCAT(B)
1 aaa,bbb,ccc,ddd 1,2,5,3
没有问题的。
问题出在你的那个 distinct
追问我没有用distinct ,顺序一样会乱。。追答drop table test;
create table test(a varchar2(30),b varchar2(30),c varchar2(30));
insert into test values('aaa','1','a');
insert into test values('bbb','2','a');
insert into test values('ccc','5','a');
insert into test values('ddd','3','a');
insert into test values('aaaaa','11','b');
insert into test values('bbbbb','22','b');
insert into test values('ccccc','55','b');
insert into test values('ddddd','33','b');
select c,max(a),max(b) from (
select c,wm_concat(a) over (partition by c order by a) a,
wm_concat(b) over (partition by c order by a) b from test
) tt
group by c ;
C MAX(A) MAX(B)
a aaa,bbb,ccc,ddd 1,2,5,3
b aaaaa,bbbbb,ccccc,ddddd 11,22,55,33