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: John Verbil <jverbil_at_netmail.mnet.uswest.com>
Date: 1996/12/16
Message-ID: <32B5BC73.6172@netmail.mnet.uswest.com>#1/1

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-0916
Received on Mon Dec 16 1996 - 00:00:00 CST

Original text of this message

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