Oracle-时间与字符串转换

--UPDATE_TIME 是时间,直接转成字符串
SELECT to_char(MAX(UPDATE_TIME), 'yyyy-mm-dd hh24:mi:ss') as lastUpdateTime,
       to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') as accountTime
  FROM QLK_AREA;
  
-- LASTUPDATETIME 是字符串,先转成时间,再转成字符串
SELECT to_char(to_date(MAX(LASTUPDATETIME), 'yyyymmddhh24miss'),
               'yyyy-mm-dd hh24:mi:ss') as lastUpdateTime,
       to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') as accountTime
  FROM PSN_MZ_LHDJXX_BL;

 

posted @ 2017-06-02 15:54  伍叶春  阅读(64854)  评论(0编辑  收藏  举报