ROWID logic is stupid idea.
You will get wrong result set over period of time.
See below:
PHP Code:
Logic based on the ROWID will NOT work always.
See the example below:
SQL> select * from a ;
B
----------
1
2
4
9
18
4
6 rows selected.
SQL> select ( sum(b) over(order by rowid)) accu from a ;
ACCU
----------
1
3
7
16
34
38
6 rows selected.
SQL> delete a where b in (1,2) ;
2 rows deleted.
SQL> commit;
Commit complete.
SQL> select * from a ;
B
----------
4
9
18
4
SQL> insert into a values (3) ;
1 row created.
SQL> commit;
Commit complete.
SQL> select * from a ;
B
----------
4
9
18
4
3 --> new row
SQL> insert into a values(1) ;
1 row created.
SQL> commit;
Commit complete.
SQL> select * from a ;
B
----------
4
9
18
4
3
1 --- new row
6 rows selected.
SQL> insert into a values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from a ;
B
----------
2 ----> This new row has the lowest rowid
4
9
18
4
3
1
7 rows selected.
You will get completely WRONG result here.
SQL> select ( sum(b) over(order by rowid)) accu from a ;
ACCU
----------
2
6
15
33
37
40
41
7 rows selected.
Tamil