Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: rownum

Re: rownum

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Mon, 16 Aug 1999 17:07:08 +0800
Message-ID: <37B7D4BC.5EDA@yahoo.com>


Norris wrote:
>
> I want to use rownum as the sequence number in the report but the result
> is not what I expect. What can I do?
>
> ------------------------------------------
> drop table abc
> /
> create table abc (a char(1))
> /
> insert into abc values ('B')
> /
> insert into abc values ('A')
> /
> select rownum,a
> from abc
> order by a
> /
> ROWNUM A
> ---------- -
> 2 A
> 1 B
> 2 rows selected.
>
> --
> --
> http://www.washington.edu/pine/faq/

rownum is assigned before the order-by clause is assigned...

in 8i you can perform things like

select * from
  ( select blah
    from table
    order by 1,2,3)

which would allow the use of rownum like you are after, but if you are using some sort of reporting tool, you'd probably be better off using a built-in facility of the tool to number your records...

HTH --



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Mon Aug 16 1999 - 04:07:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US