在工作中,出现了一个简单的问题,就是按照一定的规律将oracle数据库里面的字段值进行处理和更新,现写了以下代码进行实现,特此记录下来,以备后用:
- update t_cure_plan a set (inject) = (
- select
- case
- when inject='第一针' then '1'
- when inject='第二针' then '2'
- when inject='第三针' then '3'
- when inject='第四针' then '4'
- when inject='第五针' then '5'
- when inject='第六针' then '6'
- when inject='第七针' then '7'
- when inject='第八针' then '8'
- when inject='第九针' then '9'
- when inject='第十针' then '10'
- else inject
- end as newInject
- from t_cure_plan b where a.id=b.id
- );