LISTING 2: TRYING ROWID TO FIND THE LAST ROW

SQL> create table t ( x int, a char(2000), b char(2000), c char(2000) );
Table created.


SQL> insert into t (x) values ( 1 );
SQL> commit;

SQL> insert into t (x,a,b,c) values ( 2, 'x', 'x', 'x' );
SQL> commit;


SQL> insert into t (x,a,b,c) values ( 3, 'x', 'x', 'x' );
SQL> commit;

SQL> delete from t where x = 2;
SQL> commit;


SQL> insert into t (x,a) values ( 4, 'x' );
Now that the table is set up, try to find the "last row" by using commonly suggested techniques. Start by finding the row with the maximum ROWID:
SQL> commit;
SQL> select x from t where rowid in(select max(rowid) from t);


         X
 ----------
         3