update T set col1=case when col1 is not null then '1' else '0' end;
update T set col1='2', col2=null where col1='0' and col2='2';
update T set col1='3', col3='0' where col1='0' and col3='3';
update T set col1=null where col1='0';
update T set col1='2', col2=null where col1='0' and col2='2';
update T set col1='3', col3='0' where col1='0' and col3='3';
update T set col1=null where col1='0';
set
col1=docode(col3,'3','3',decode(col2,'2','2',decode(col1,null,col1,'1'))),
col2=decode(col2,'2',null,col2),
col3=decode(col3,'3','0',col3)
set
col1=docode(col3,'3','3',decode(col2,'2','2','1')),
col2=decode(col2,'2',null,col2),
col3=decode(col3,'3','0',col3)
where col1 is not null
col1, col2, col3
2 2 3按照我的要求,应该更新成
1 2 3可是按照你给的程序,似乎有问题.
set col1 = decode(col1, null,decode(col2,'2',2,decode(col3,'3',3,col1)),'1'),
col2 = decode(col1, null,decode(col2,'2',null,col2),col2),
col3 = decode(col1,null,decode(col2,'2',col3,decode(col3,'3',null,col3)),col3);
commit ;