René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

ORA-00935

create table na (
  id_1  number,
  id_2  number,
  val   number
);


insert into na values (1, 1,  11);
insert into na values (1, 1,  71);
insert into na values (1, 1,  91);

insert into na values (1, 2,  42);
insert into na values (1, 2,  52);
insert into na values (1, 2,  42);
insert into na values (1, 2,  22);

insert into na values (1, 3,  33);
insert into na values (1, 3,  63);

insert into na values (2, 1, 151);

insert into na values (2, 2, 122);
insert into na values (2, 2, 102);
select         max(val)   from na group by id_1, id_2;
  MAX(VAL)
----------
       151
        52
        63
        91
       122
select     avg(max(val))  from na group by id_1, id_2;
AVG(MAX(VAL))
-------------
         95.8
95.8 = (151+52+63+91+122)/5
select max(avg(max(val))) from na group by id_1, id_2;
This last query results in a ORA-00935.