1、创建测试表,
create table test_date_conv(id varchar2(20),v_date varchar2(200));
2、插入测试数据;
insert into test_date_conv values(1, 20190101122359);
insert into test_date_conv values(2, 20190115132359);
insert into test_date_conv values(3, 20190125052359);
insert into test_date_conv values(4, 20190125122359);
insert into test_date_conv values(5, 2019013119359);
commit;
3、查询表中全量数据;select t.*, rowid from test_date_conv t;
4、编写语句,转换成成YYYY-MM-DD HH:mm:ss格式;
select t.*, to_char(to_date(v_date,'yyyymmddhh24miss'),'yyyy-mm-dd hh24:mi:ss') v2 sec from test_date_conv t;
select to_char(to_date('20150413090101','yyyymmddhh24miss'),'yyyy-mm-dd hh24:mi:ss') from dual
select substr(a, 1, 4) || '-' || substr(a, 5, 2) || '-' || substr(a, 7, 2) || ' ' ||
substr(a,9, 2) || ':' || substr(a,11, 2) || ':' || substr(a,13, 2)
from dual
select to_date('20150413092155','yyyy-mm-dd hh24:mi:ss') from dual
to_date('20150413092155','yyyy-mm-dd HH:mm:ss')