文档解释 ORA-56902: expect aggregate function inside pivot operation Cause: Attempted to use non-aggregate expression inside
ORA-56902: expect aggregate function inside pivot operation
Cause: Attempted to use non-aggregate expression inside pivot operation.
Action: Use aggregate function.
等。
ORA-56902: expect aggregate function inside pivot operation 错误指出其缺少聚集函数,是一种PIVOT操作语法错误。
1. 使用聚集函数将表进行聚合合并,比如如下:
SELECT emp_id, year, SUM(salary) as salary FROM emp GROUP BY emp_id,year;
2. 执行上一步后的结果,再执行PIVOT操作:
SELECT * FROM ( SELECT emp_id, year, sum(salary) FROM emp GROUP BY emp_id,year ) PIVOT( SUM(salary) FOR year IN (2010,2011,2012,2013,2014) );
以上两步,再加上PIVOT个性化设置就可以完成一个PIVOT操作,从而获取转换后的数据统计。
--结束END--
本文标题: ORA-56902: expect aggregate function inside pivot operation ORACLE 报错 故障修复 远程处理
本文链接: https://lsjlt.com/news/537727.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0