Code: Select all
SQL> select * from temp5 order by 1;
C1 C2
---------- ----------
1 0
2 0
3 0
4 0
SQL> update temp5 a
2 set c2 = (
3 select c2+1
4 from temp5 b
5 where b.c1 = a.c1-1
6 );
4 rows updated.
SQL> select * from temp5 order by 1;
C1 C2
---------- ----------
1
2 1
3 1
4 1
ожидалось:
C1 C2
---------- ----------
1
2 1
3 2
4 3