This is one of those really dangerous things... because what happens when we decide to make the simplest of changes to the database:
SQL> create table t1 ( x int, y int );
Table created.
SQL> create table t2 as select rownum a from dual connect by level <= 250;
Table created.
SQL> create or replace
2 function count_of_t1 return int is
3 x int;
4 begin
5 select count(*) into x from t1;
6 return x;
7 end;
8 /
Function created.
SQL>
SQL> create index T2_IX on T2 ( a ) ;
Index created.
SQL> alter table t2 modify a not null;
Table altered.
SQL>
SQL>
SQL> declare
2 cursor cur is select a, count_of_t1 cnt from t2 order by a ;
3 l_rows int := 0;
4 begin
5 for rec in cur loop
6 dbms_output.put_line(rec.a||','||rec.cnt);
7 insert into t2 values (0);
8 insert into t1 values (1,1);
9 l_rows := l_rows + 1;
10 end loop;
11 dbms_output.put_line('Total rows ='||l_rows);
12 end;
13 /
1,0
2,0
3,0
4,0
5,0
6,0
7,0
8,0
9,0
10,0
11,0
12,0
13,0
14,0
15,0
16,0
17,0
18,0
19,0
20,0
21,0
22,0
23,0
24,0
25,0
26,0
27,0
28,0
29,0
...
96,0
97,0
98,0
99,0
100,0
101,100
102,100
103,100
104,100
105,100
106,100
107,100
108,100
109,100
...
190,100
191,100
192,100
193,100
194,100
195,100
196,100
197,100
198,100
199,100
200,100
201,200
202,200
203,200
204,200
205,200
206,200
207,200
208,200
209,200
210,200
211,200
212,200
213,200
214,200
215,200
216,200
217,200
218,200
219,200
220,200
221,200
222,200
...
249,200
250,200
Total rows =250
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
SQL>
It's like the days of when GROUP BY always did a sort, so people started omitting the ORDER BY. When GROUP BY *stopped* sorting, their results were garbage.
You never want the presence of an index (or anything else that might impact the optimizer) to be able to *change* the results you get.