- 论坛徽章:
- 0
|
目的:要将文本中每行的时间字段,如'20100510161212'替换为to_date('20100510161212','yyyymmddhh24Miss')
文本如下:
insert into info values('23399','136.2.2.2','132.1.4.122','NIC_20100329.0001','4096','20100510161212','20100510161214');
insert into info values('23400','136.2.2.2','132.1.4.122','NIC_20100328.0001','4096','20100510161212','20100510161214');
insert into info values('23401','136.2.2.2','132.1.4.122','NIC_20100328.0001','4096','20100510161212','20100510161214');
替换后的文本:
insert into info values('23399','136.2.2.2','132.1.4.122','NIC_20100329.0001','4096',to_date('20100510161212','yyyymmddhh24Miss'),to_date('20100510161214','yyyymmddhh24Miss'));
insert into info values('23400','136.2.2.2','132.1.4.122','NIC_20100328.0001','4096',to_date('20100510161212','yyyymmddhh24Miss'),to_date('20100510161214','yyyymmddhh24Miss'));
insert into info values('23401','136.2.2.2','132.1.4.122','NIC_20100328.0001','4096',to_date('20100510161212','yyyymmddhh24Miss'),to_date('20100510161214','yyyymmddhh24Miss'));
PS:文本中时间字段的位置可能不同,比如这个文本,以“,”为分隔符,时间字段是第6,7两个字段。可能另外一个文本是在2,3,4字段。 |
|