niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle
Can we use ORDER BY in view?
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
DA Morgan
*nix forums Guru


Joined: 06 Mar 2005
Posts: 1042

PostPosted: Mon Feb 28, 2005 4:03 pm    Post subject: Re: Can we use ORDER BY in view? Reply with quote

Mark D Powell wrote:

Quote:
What version of whose student guide do you have? Order by clauses in
views were not supported back in version 7, but this restriction has
been lifted. I do not remember the exact version when Oracle lifted
this restriction; it may have been with one of the 8.1 versions.
However, order by clauses should appear in views only where necessary
to create the correct result set. In the majority of cases the final
set ordering should be specified with the query on the view.

Someone else might remember the version where this changed but with 9.2
it is legal.

HTH -- Mark D Powell --

At issue here is Couchman's book. Couchman may know Oracle but his
editors didn't do him a service when they took his 8i book and tried
to relabel it as 9i.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)
Back to top
DA Morgan
*nix forums Guru


Joined: 06 Mar 2005
Posts: 1042

PostPosted: Mon Feb 28, 2005 3:42 pm    Post subject: Re: Can we use ORDER BY in view? Reply with quote

dd wrote:

Quote:
Can we use ORDER BY clause in view's definition:

CREATE OR REPLACE VIEW a_v as
select * from a order by 1;

According to Oracle's Student Guide, this is not allowed. But, by my
testing with 9iR2, it is allowed. So what is the exact rule?

The Student Guide has many many errors. That is one of many reasons why
it is of limited if not negative value.

Another error is the claim that:

SELECT deptno, avg(sal), job
FROM emp
GROUP BY deptno;

isn't valid: It is.

And there are at least 50 more.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)
Back to top
Mark D Powell
*nix forums Guru


Joined: 23 Apr 2005
Posts: 701

PostPosted: Mon Feb 28, 2005 2:06 pm    Post subject: Re: Can we use ORDER BY in view? Reply with quote

What version of whose student guide do you have? Order by clauses in
views were not supported back in version 7, but this restriction has
been lifted. I do not remember the exact version when Oracle lifted
this restriction; it may have been with one of the 8.1 versions.
However, order by clauses should appear in views only where necessary
to create the correct result set. In the majority of cases the final
set ordering should be specified with the query on the view.

Someone else might remember the version where this changed but with 9.2
it is legal.

HTH -- Mark D Powell --
Back to top
dd
*nix forums beginner


Joined: 08 Jun 2005
Posts: 14

PostPosted: Mon Feb 28, 2005 11:20 am    Post subject: Can we use ORDER BY in view? Reply with quote

Can we use ORDER BY clause in view's definition:

CREATE OR REPLACE VIEW a_v as
select * from a order by 1;

According to Oracle's Student Guide, this is not allowed. But, by my
testing with 9iR2, it is allowed. So what is the exact rule?
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 6:00 am | All times are GMT
navigation Forum index » Databases » Oracle
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts hi, I am not able view all the records in the tabel Annam Srinivas MySQL 0 Fri Jul 21, 2006 7:42 am
No new posts Creating relational view for an ODBC result set? antilog@gmail.com Server 0 Fri Jul 21, 2006 5:56 am
No new posts "ORDER BY" question Mr.Kane Oracle 3 Wed Jul 19, 2006 10:53 pm
No new posts mysql order question OKAN ARI MySQL 1 Wed Jul 19, 2006 7:03 pm
No new posts Constraint for two fields unique any order MargaretGillon@chromalloy PostgreSQL 5 Wed Jul 19, 2006 4:01 pm

Secured Loans | Customer services | Problem Mortgage | Credit Cards | Credit Card Application
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1324s ][ Queries: 20 (0.0529s) ][ GZIP on - Debug on ]