Order By Problem
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Order By Problem

  1. #1
    Join Date
    May 2002
    Posts
    15
    Hi all,
    Here is my question:
    If I do not specify ORDER BY clause in SELECT statement is it true that rows that are retreived are ordered by ROWID?
    I have tested this on couple statements.

    SELECT * FROM MY_TABLE;
    (buffer cach is big enough to store all records)

    then :

    SELECT * FROM MY_TABLE ORDER BY COL_1

    and then again:

    SELECT * FROM MY_TABLE;

    First and third statements have returned records ordered by ROWID.

    So does Oracle internaly use ORDER BY ROWID if there is no other ORDER BY clause.

    Thanks,

  2. #2
    Join Date
    Aug 2001
    Location
    chennai,bangalore
    Posts
    840
    Yes ur right....

    regards
    anandkl
    anandkl

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    No, of course Oracle does not sort resultset by ROWIDs (if you don't explicitely tell it to do so). Never! It doesn't sort by anything if it doesn't need to, why would it?

    In your case (as in many cases, particulary with relatively small tables that have only one extent) it just happens that full table scan retrives the records in such a manner that they appear to be sorted by ROWIDs. But Oracle realy didn't sort them that way.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width