Re: Oracle equivalent of the MSSQL row_number() function

From: joel garry <joel-garry_at_home.com>
Date: Mon, 22 Aug 2011 09:05:13 -0700 (PDT)
Message-ID: <4a162e73-1fc5-4208-9ccf-2639cdb3e883_at_v9g2000pri.googlegroups.com>



On Aug 21, 10:33 am, luisdev <and..._at_webmail.co.za> wrote:
> On Aug 21, 7:12 pm, Mladen Gogala <gogala.mla..._at_gmail.com> wrote:
>
> > I doubt that SQL Server would require such a clumsy construct. This query
> > would also be perfectly legal in the Oracle world. Please note that logic
> > is deeply flawed. You are ordering the grades and selecting only the
> > first rows, instead of just selecting the maximum.
>
> Thanks for the help and the code. Apologies for posting in the wrong
> group...
> It's not "homework"! I've been out of "school" for a long time :->
>
> What groups are more suited to PL/SQL questions?
>
> Thanks again for your response...

There are several groups associated with comp.databases.oracle.*. They are: server, misc, tools and marketplace. The groups are defined in the charter, available http://www.dbaoracle.net/readme-cdos.htm#subj3. This arrangement came about because one old group called cdo was getting a bit overwhelmed. People aren't too picky about following the charter (except for commercial postings), since many read all the non-marketplace groups, especially now that there are so many other places to go that usenet has been on life-support. But still, many people lurk and will come out of the woodwork with an interesting question, and some of us are still regulars here. Technically, language questions usually are associated with tools, while dba questions would be server, but it really makes more of a difference that the question is well written.

But of course, your question is not a PL/SQL question (and if it were, the answer would be to use SQL). It can be a bit confusing, but the difference is procedural v. non-procedural. In general, a relational database can work better with non-procedural constructs based on set theory. Some people coming from t-sql want to do everything procedurally, and it is often hard to convince them that may not be the best. Hard to tell from one question, but the fact that you used this type of syntax shows you are one step ahead of the pack, regardless of Mladen's judgment of one piece of code. But he gave you a better answer, which is always a positive sign in these groups. We do see a lot of homework questions similar to yours here, especially this time of year, so don't let that bother you.

jg

--
_at_home.com is bogus.
http://www.signonsandiego.com/news/2011/aug/19/ntn-buzztime-cuts-churn-reports-wider-loss/
Received on Mon Aug 22 2011 - 11:05:13 CDT

Original text of this message