ORA-00979: not a GROUP BY expression报错处理

2014-11-24 17:46:37 · 作者: · 浏览: 0


这条语句在其他大区的DB上执行均OK,在体验服DB上执行报错。从语法上看,确实是完全没问题的。



碰到这种ORA-报错的情况,我们可以通过设置ErrorStack对错误堆栈进行跟踪,将错误的后台信息比较详尽的转储到跟踪文件,供分析研究。



ErrorStack的四个级别及说明:
0 Error stack only
1 Error stack and function call stack
2 As level 1 plus the process state
3 As level 2 plus the context area



ErrorStack仅在特定的错误出现的时候才被触发。可以在实例或者会话级别进行设置。



下面我们进行979的ErrorStack跟踪:
SQL> alter system set events='979 trace name errorstack forever,level 3';


System altered.


SQL> select a.d1,a.EXIT_type,round(a.cnt1/b.cnt2*100,2) from
2 (select substr(LOGIN_DATE,1,8) d1,EXIT_type,count(*) cnt1 from xxx_connect_log group by substr(LOGIN_DATE,1,8),EXIT_type) a,
3 (select substr(LOGIN_DATE,1,8) d2 ,count(*) cnt2 from xxx_connect_log group by substr(LOGIN_DATE,1,8) ) b
4 where A.d1=B.d2 order by a.d1,a.EXIT_type;
(select substr(LOGIN_DATE,1,8) d2 ,count(*) cnt2 from xxx_connect_log group by substr(LOGIN_DATE,1,8) ) b
*
ERROR at line 3:
ORA-00979: not a GROUP BY expression



SQL> alter system set events='979 trace name errorstack off';


System altered.


相关阅读: