Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORDER BY in view definitions

KevinDClarkeJun 13 2002
ORDER BY was not allowed in view definitions in 7.3.4. It is allowed in 8.1.6 but I have not seen any documentation to say when or why it was introduced.

There is an old rule that a select statement does not guarantee the order of rows without an order by. Does this mean that this rule is no longer strictly true, ie the order IS guaranteed if selecting from a view which itself contains an order by ?

If the order of rows in this case is NOT guaranteed, then why allow an order by in the view definition?

This was brought to my notice by other writers to this forum who have pointed out that
(if the view does indeed guarantee the order of rows), then the pseudo column ROWNUM at last becomes useful for applying sequence numbers to queried rows if an in-line view with an order by is used. ROWNUM used to be of limited use because it was assigned before the order by.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2002
Added on Jun 13 2002
23 comments
3,113 views