Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In oracle , can we use Order by clause in views?
when i use i didnot get sorted values.
I am using like
select empno,empname from emp order by empname;
how to use in Oracle.

Thanks All.
Posted

For a view it's not possible to use Order By (as far as I know). What is possible is to define an Order By clause when querying the view itself ;)
 
Share this answer
 
Hi,

When ORDER BY is used in the definition of a view, inline
function, derived table, or subquery, the clause is used
only to determine the rows returned by the TOP clause.
The ORDER BY clause does not guarantee ordered results
when these constructs are queried, unless ORDER BY is
also specified in the query itself.

If you want to see the contents of the view in a particular
order, you must specify ORDER BY when you query the view.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900