Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to add and populate a new column?
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-0916Received on Mon Dec 16 1996 - 00:00:00 CST
![]() |
![]() |