SQL> with tab as( 2 select 5 id from dual union all 3 select 5 id from dual union all 4 select 5 id from dual union all 5 select 6 id from dual union all 6 select 6 id from dual) 7 select id,id+row_number()over(partition by id order by 1)-1 id from 8 / ID ID ---------- ---------- 5 5 5 6 5 7 6 6 6 7SQL>with tab as( select 5 id from dual union all select 5 id from dual union all select 5 id from dual union all select 6 id from dual union all select 6 id from dual) select id,id+row_number()over(partition by id order by 1)-1 id from tab /
updata tableName t1 set t1.id = (select t2.id+row_number()over(partition by t2.id order by 1)-1 id from tabName t2 where t1.id = t2.id and t1.rowid=t2.rowid) /
SQL> with tab as(
2 select 5 id from dual union all
3 select 5 id from dual union all
4 select 5 id from dual union all
5 select 6 id from dual union all
6 select 6 id from dual)
7 select id,id+row_number()over(partition by id order by 1)-1 id from
8 / ID ID
---------- ----------
5 5
5 6
5 7
6 6
6 7SQL>with tab as(
select 5 id from dual union all
select 5 id from dual union all
select 5 id from dual union all
select 6 id from dual union all
select 6 id from dual)
select id,id+row_number()over(partition by id order by 1)-1 id from tab
/
(select t2.id+row_number()over(partition by t2.id order by 1)-1 id from tabName t2 where t1.id = t2.id and t1.rowid=t2.rowid)
/