Oracle的函数:截取和合并
程序员文章站
2024-03-12 20:27:50
...
select to_char(t.create_time,'yyyy-mm-dd')as date_,remark,
substr(t.remark, 1, 4) as yyyy,
substr(t.remark, 5, 2) as dd,
(case
when substr(t.remark, 7, 2) = '00' then
'01'
else
substr(t.remark, 7, 2)
end) as dd
,
(substr(t.remark, 1, 4)||'-'||substr(t.remark, 5, 2)||'-'||
(case
when substr(t.remark, 7, 2) = '00' then
'01'
else
substr(t.remark, 7, 2)
end))as cjd
from temp_xxx t;
update temp_xxx t1 set t1.create_time=to_date(
substr(t1.remark, 1, 4)||substr(t1.remark, 5, 2)||
(case
when substr(t1.remark, 7, 2) = '00' then
'01'
else
substr(t1.remark, 7, 2)
end)
,'yyyymmdd'
);
[img]http://dl2.iteye.com/upload/attachment/0086/2475/409dbe40-b2a3-346f-aa43-8353abea506a.png[/img]
下一篇: 一些有意思的题目