[askdba] Update using sequences

  • From: "Mudhalvan, Moovarkku" <mmudhalvan@xxxxxxxxxxxxxxx>
  • To: <askdba@xxxxxxxxxxxxx>
  • Date: Tue, 26 Oct 2004 11:04:16 +0900

Dear Friends,
        I have to update the values of one table using Sequence. I know
we can update using sequence and it is working fine using the following
Query. 
 
        UPDATE TBL_SEQ_TRANS SET KEY_NEW_VALUE=
SEQ_TRANSACTION_ID.NEXTVAL <mailto:SEQ_TRANSACTION_ID.NEXTVAL@CAPITAL> 
    
        But i have to update in the ascending order for example my table
TBL_SEQ_TRANS have two fields KEY_VALUE and KEY_NEW_VALUE
    
        KEY_VALUE have the values 10,30,20,50,40 . If i use the above
query it is updating like
        
        KEY_VALUE         KEY_NEW_VALUE
            10                            1
            30                            2
            20                            3
            50                            4
            40                            5
 
    But i need something like this query UPDATE TBL_SEQ_TRANS SET
KEY_NEW_VALUE= SEQ_TRANSACTION_ID.NEXTVAL
<mailto:SEQ_TRANSACTION_ID.NEXTVAL@CAPITAL>  ORDER BY KEY_VALUE;
    so that i will get the output like 
 
        KEY_VALUE         KEY_NEW_VALUE
            10                            1
            30                            3
            20                            2
            50                            5
            40                            4
     Please let me know if you have any idea.
 
Thank You
Mudhalvan M.M
------------------------------------------------------------------------
------------
Global Commercial Real Estate (Japan) Inc.
Moovarkku Mudhalvan, OCP 8i,9i 
Database Administator, 
E-mail: mmudhalvan@xxxxxxxxxxxxxxx <mailto:mmudhalvan@xxxxxxxxxxxxxxx> 
 

Other related posts: