Question: I want to find the first row
inserted into an Oracle database. How can I accomplish this?
Answer: In order to locate the first row
inserted into a table, one of the columns
must contain either a date or timestamp which was populated
by sysdate at the time of insertion. As long as this
requirement is met, it is a simple matter of querying the minimum
value of the timestamp/date field and selecting the relevant
information from it:
insert into mytab (vehicle_id, last_row) 123,
Oracle does not insert rows in any particular order, and rows are
inserted based on the next free block in the table's tablespace.
Hence, you need to procedurally mark the "first", "next" or "last"
rows in a table.
Also, see my notes on finding
the top "n" rows
in a table and the
"top 10" rows.
Get the Complete
Oracle SQL Tuning Information
The landmark book
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
for 30% off directly from the publisher.