Hello,
I have a question why this cursor fails to open with ora 00979 error (not a group by expression):
declare
cursor c_test(p_prm in varchar2) is
select
decode(p_prm, 1, dummy, 1)
,count(distinct dummy)
from dual
group by
decode(p_prm, 1, dummy, 1);
begin
open c_test(1);
close c_test;
end;
I found that cursor opens successfuly if you do any of the following:
- Remove distinct
- Comment out any of columns
- instead of p_prm in a cursor use fixed value like "1"
I want to understand why execution fails in this specific case.
Database version: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
Thank you