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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to add and populate a new column?

Re: How to add and populate a new column?

From: Gus Spier <gus_at_shirenet.com>
Date: 1996/12/20
Message-ID: <32BA4CAA.7545@shirenet.com>#1/1

John Verbil wrote:
>
> Z. Martinez wrote:
> >
> > I need to add a new column, called rank, in a table called customers.
> > The "rank" column depends on another column called quantity.
> > So, the row that has the highest "quantity" value gets a "rank" value
> > of 1, and the lowest quantity value gets the last rank.
> >
> > Can anybody tell me how to add the new column and populate it.
>
> Are you sure you want to do this? This appears to be a pretty
> significant denormalization, and would mean that every time you
> insert/update/delete a row, you'll have to go through the entire table
> and repopulate that column. That's a lot of work if the table is big.
> You may simply want to create a cursor (or two) that can return rows to
> you in forward (or reverse) order, using ROWNUM, if necessary, to give
> you a ranking.
>
> --
> John Verbil
> U S WEST Communications
> Information Technologies
> jverbil_at_uswest.com
> (303) 896-0916John,

Could some kind of DECODE be added to a cursor to translate the rowid to a rank?

Gus Received on Fri Dec 20 1996 - 00:00:00 CST

Original text of this message

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