oracle修改一个字段的某部分内容

select replace(deptcode,'-21-','-') from sys_department where deptcode like '%-21-%';--查询总共有多少需要替换
select replace(deptcode,'-22-','-') from sys_department where deptcode like '%-22-%';
update sys_department set deptcode=replace(deptcode,'-21-','-') where deptcode like '%-21-%';--替换这个字段的内容
update sys_department set deptcode=replace(deptcode,'-22-','-') where deptcode like '%-22-%';

猜你喜欢

转载自jatter.iteye.com/blog/2278411