Problem solve Get help with specific problems with your technologies, process and projects.

Does Oracle retrieve records in the same order they were insterted?

Does Oracle retrieve the records from a table in a same order they were inserted (FIFO), assuming that there is no insertion/deletion/updation of records after the records are inserted first and no ORDER/GROUP BY clause is used while retrieving?

In the following query, will the results display the first 500 records of a table in a way they were inserted?


Relational database theory does not guarantee ordering of records. So you cannot guarantee that records will come out in the same order that they were entered. If there were no insertions/deletions/updations, then you still cannot guarantee order. The "order" can be thrown out of whack when extents are allocated and other internal operations. It is best to use some sort of time-relative sequence and sorting the data on the sequence.

But if all data fits into one extent, no DML has been performed against the table, and no sorting occurs on the data, then yes, they will come out in the same order.

As for the second part, after you've read the first part of this answer, then yes, this will result in the first 500 records inserted into the table.

For More Information

  • What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.