oracle中如何将071000转换成07:10:00

oracle中如何将071000转换成07:10:00
2024-12-20 10:44:57
推荐回答(3个)
回答1:

进行两次类型转换
一次是char转成date
然后再把date转成char

select to_char(to_date('071000','hh24miss'),'hh24:mi:ss') from dual;

直接执行上句即可

回答2:

你的这个071000是什么类型的,若是字符型的:
select substr('071000',1,2)||':'||substr('071000',3,2)||':'||substr('071000',5,2) from dual;
若是数字型的:
select substr(to_char(071000),1,2)||':'||substr(to_char(071000),3,2)||':'||substr(to_char(071000),5,2) from dual;

回答3:

select substr('071000',1,2)||':'||substr('071000',3,2)||':'||substr('071000',5,2) from dual;