17,082
社区成员
发帖
与我相关
我的任务
分享
SQL> select * from t;
A B C D E MAX
--------------------- --------------------- --------------------- --------------------- --------------------- ---------------------
1 12 3 2 12
3 23 5 3 6
32 64 6 8 32
23 66 87 34 23
SQL>
SQL> update T
2 set t.max=t.a;
4 rows updated
SQL> update t
2 set t.max=decode(sign(t.max-b),1,t.max,b);
4 rows updated
SQL> update t
2 set t.max=decode(sign(t.max-c),1,t.max,c);
4 rows updated
SQL> update t
2 set t.max=decode(sign(t.max-d),1,t.max,d);
4 rows updated
SQL> update t
2 set t.max=decode(sign(t.max-e),1,t.max,e);
4 rows updated
SQL> SELECT * FROM t;
A B C D E MAX
--------------------- --------------------- --------------------- --------------------- --------------------- ---------------------
1 12 3 2 12 12
3 23 5 3 6 23
32 64 6 8 32 64
23 66 87 34 23 87
SQL>