Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle Table

Status
Not open for further replies.

Whitebat

Technical User
Jun 19, 2001
47
DE
Hello, i use oracle 8i on win nt. i have a table and i just want make a select statement which shows me the first row of the table. How can i do that ?
 
The proposed solution will not nessesarily give you the first row. You have to order the selected rows (order by ...) to qualify the rigth row. Else you may get different rows when executing the statement.
 
You might try:

SELECT * FROM my_table
WHERE rowid = (SELECT min(rowid) FROM my_table);

This should give you the first physical row in the table. However, since Oracle recycles space as it becomes available, this will not necessarily be the first chronilogical row in the table.
 
Well, I meant first row for that particular query (every execution of it). Since Oracle, and ANSI SQL, say tables are a set (i.e. not ordered), you cannot have "first" row in a chronologycal sense. If you want to have this order, you'll have to maintain it, for example you can have a sequence-generated column in your table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top