DECLARE
trn VARCHAR2(2) := 'DD';
cur SYS_REFCURSOR;
BEGIN
OPEN cur FOR
SELECT
TRUNC(some_date, trn),
NULL AS dummy_2,
COUNT( DISTINCT dummy_1 )
FROM
(SELECT SYSDATE AS some_date, ROWNUM AS dummy_1 FROM dual)
GROUP BY
TRUNC(some_date, trn);
END;
这适用于 Oracle 10,但Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
结果是:
ORA-00979: 不是 GROUP BY 表达式
ORA-06512: 在第 5 行
任何人都可以重现/解释这一点吗?谢谢!