create table tq84_ora_22818_test (a number);
begin
insert into tq84_ora_22818_test values (1 );
insert into tq84_ora_22818_test values (2 );
insert into tq84_ora_22818_test values (null);
end;
/
select
count(a) cnt_a,
(select count(*) from tq84_ora_22818_test where a = 1) cnt_a_1
from
tq84_ora_22818_test;
The following statement throws ORA-22818: subquery expressions not allowed here
select
count(a) cnt_a,
(select count(*) from tq84_ora_22818_test where a = 1) cnt_a_1
from
tq84_ora_22818_test
group by
(select count(*) from tq84_ora_22818_test where a = 1);
drop table tq84_ora_22818_test;