SELECT TO_DATE ( TO_CHAR (EXTRACT (MONTH FROM schedule.start_date))
|| '-'
|| TO_CHAR (EXTRACT (DAY FROM schedule.start_date))
|| '-'
|| TO_CHAR (EXTRACT (YEAR FROM schedule.start_date))
|| ' '
|| TO_CHAR (schedule.start_time_hour)
|| ':'
|| TO_CHAR (schedule.start_time_minutes)
|| schedule.start_time_am_pm,
'DD-MM-YYYY HH24:MI pm'
)
FROM table1 schedule;
在table1
start_date 字段值中包含的日期为14-Apr-12 12:00:00 AM
, start_time_hour
值为hour
,start_time_minutes
值为minutes
,start_time_am_pm
值为AM or PM
。我想将这些列合并成一个字符串。我将转换为日期格式,如to_date('14-04-12 05:08 PM','DD-MM-YYYY HH:MI PM')
. 但它会抛出错误ORA-01858: a non-numeric character was found where a numeric was expected
。这是什么问题..可以帮助我如何按照我的上述要求转换为日期格式。