There are two select statements:
select max(min(str)) from (select 0 id, 'a' str from dual) group by id having min(str) = 'a';
select strconcat(min(str)) from (select 0 id, 'a' str from dual) group by id having min(str) = 'a';
The only difference is the outer-level aggregate function: max() vs. strconcat().
You can replace strconcat() with any UDAF you have.
The former statement works as expected: it returns string 'a'.
The latter statement:
- (on Oracle 10g) gives wrong result (null instead of string 'a')
- (on Oracle 11g) raises ORA-00979: not a GROUP BY expression
I don't understand this error message.
Could you please explain this behavior?
Is it an Oracle bug?