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: Update based on order

Re: Update based on order

From: Martin Haltmayer <Martin.Haltmayer_at_d2mail.de>
Date: Tue, 18 Dec 2001 13:40:14 +0100
Message-ID: <3C1F392E.8F204B69@d2mail.de>


Hi Prakash,

sure you can do this. What is your Oracle version? Which columns uniquely define the sort order of your table?

Martin

Prakash C N wrote:
>
> Hi
>
> can i execute an update statement based on order,
> for example
> update tab1 set col1 = running_number
> where col2 = 1 order by col3 desc
>
> here col1 will be geting a running number that means for
> each record updated col1 will have the next number
>
> sample output before update
> col1 col2 col3
> 5 1 Z
> 6 1 a
> 4 1 T
> 1 2 Y
> 2 2 x
>
> sample output after update
> col1 col2 col3
> 4 1 T
> 5 1 Z
> 6 1 a
> 1 2 Y
> 2 2 x
Received on Tue Dec 18 2001 - 06:40:14 CST

Original text of this message

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