OILDATE为varchar类型,欲将 20141130120140 格式化为 2014-11-30 12:01:40
select to_char(to_date(OILDATE, 'YYYYMMDD HH24MISS'),
'YYYY-MM-DD HH:MM:SS') AS OILDATE FROM PS_NYGK_OIL_GAS
先转换成date类型,然后再转换为varchar类型,必须是HH24MISS,不然报ORA-01810错误
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/4112.html