ORA-00923: 未找到要求的FROM关键字

版权声明:转载本博客,请注明来源,谢谢 https://blog.csdn.net/kisorl/article/details/81701440

问题记录一下:列转行listagg()函数 只能在oracle11g以上版本使用,也就是说oracle 10g一下版本不支持该函数。

原始sql:

select A.userid as czry,A.Mail_Addr as yxdz,A.Lxdh,LISTAGG(B.Compname,',') WITHIN group(order by A.userid) sydw from T_SW_ELEINVOICE_MAILSET A,companyinfo B where A.compid = B.compid group by A.userid ,A.Mail_Addr,A.Lxdh ;

处理:使用WM_CONCAT()函数来代替listagg()函数,但是在WM_CONCAT()函数在oracle10G下查询结果为String类型,在oracle11G下查询结果为blob类型

优化后sql:

select A.userid as czry,A.Mail_Addr as yxdz,A.Lxdh,WMSYS.WM_CONCAT(B.COMPNAME) AS SYDW  from T_SW_ELEINVOICE_MAILSET A,companyinfo B where A.compid = B.compid group by A.userid ,A.Mail_Addr,A.Lxdh ;

猜你喜欢

转载自blog.csdn.net/kisorl/article/details/81701440
今日推荐