Document Type | Technical Information
CATEGORY | Administration
Document Number | TADTI061
Overview
This explains how to extract the last changed row in a table.
select col1, col2 from last_row_test
where ( rowtsn <> (select min(rowtsn) from last_row_test)
and rowtsn <> (select max(rowtsn) from last_row_test) );
Method
1. Create Table
create table last_row_test ( col1 number, col2 varchar2(50));
2. Insert Initial Data
insert into last_row_test select level, level||'test' from dual connect by level <= 10; commit;
3. Check rowtsn of Initial Data
select rowtsn , col1 from last_row_test; 1142214 1 1142214 2 1142214 3 1142214 4 1142214 5 1142214 6 1142214 7 1142214 8 1142214 9 1142214 10 10 rows selected.
4. Perform Tests by Repeating Insert / Update