Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Question : From MS SQL Server to Oracle
Warning! Andrew's query does not do what you want.
(Test it. You'll see.)
ROWNUM is a pseudocolumn and the values are assigned BEFORE any sorting takes place. So you effectly get 10 randomly selected entries from the table which are then ordered by Col1.
Basically to do the exact same thing as SQL Server, you will need to write a PL/SQL procedure. Search this groups for previous discussions on this topic. Code has been posted before. (I may have a copy somewhere.)
Good luck.
In article <7kvd92$dhn$1_at_wanadoo.fr>,
"Erwin jasinski" <hexalog_at_wanadoo.fr> wrote:
> Andy,
>
> It's OK !
> Thank you very much.
> Erwin
>
> andrew_at_soft-solutions-inc.com a écrit dans le message
> <377299e5.87491766_at_news.ufl.edu>...
> >On Thu, 24 Jun 1999 16:01:38 +0200, "Erwin JASINSKI"
> ><hexalog_at_wanadoo.fr> wrote:
> >
> >I think you will get what you are looking for with this:
> >
> >SELECT T1.Col1
> >FROM Table T1
> >WHERE ....
> > and rownum < 11
> >ORDER BY T1.Col1;
> >
> >
> >rownum is a special column that counts the number of rows returned -
> >the above query will give you the first 10 rows of the results set.
> >
> >Thanks,
> >Andy
>
>
--
Ed Prochak
Magic Interface, Ltd.
ORACLE services
440-498-3702
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Fri Jun 25 1999 - 12:18:31 CDT