Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to add and populate a new column?
Roger Snowden wrote:
>
> John Verbil <jverbil_at_netmail.mnet.uswest.com> wrote in article
> <32BB0B5C.6663_at_netmail.mnet.uswest.com>...
> > I don't see how. ROWIDs have no correlation to any ORDER BY clause in a
> > cursor. ROWNUM will assign numbers 1-N to each row returned based on
> > the ORDER BY clause.
> > John Verbil
> > U S WEST Communications
>
> Sorry, but this is dangerously incorrect. ROWNUM is a psuedocolumn which
> identifies relative row number within a result set, and is assigned BEFORE
> the order by clause is executed.
>
> Roger
Whoops, you're right of course; I must've been brain-damaged that day. I meant to say GROUP BY in a VIEW, like so:
create table ABC
(
SOME_NUMBER number
);
create view ABC_VIEW as
select SOME_NUMBER from ABC group by SOME_NUMBER;
select SOME_NUMBER, ROWNUM from ABC;
This will return the rows from ABC in SOME_NUMBER order with ROWNUM representing the order number.
Sorry for the original brain-damaged response.
-- John Verbil U S WEST Communications Information Technologies jverbil_at_uswest.com (303) 896-0916Received on Tue Jan 07 1997 - 00:00:00 CST
![]() |
![]() |