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;
In table1 the start_date field value contains the date as 14-Apr-12 12:00:00 AM, start_time_hour has the value of the hour, start_time_minutes has the value of minutes , start_time_am_pm has the value of AM or PM. I want to merge this columns into a string from that. I am going convert into date format like to_date('14-04-12 05:08 PM','DD-MM-YYYY HH:MI PM'). But it throws the error ORA-01858: a non-numeric character was found where a numeric was expected. What is the issue on this.. Can any help me how to convert into date format with my above requirment.
IF schedule.start_date is truncated at 00:00 and you have time info in the columns start_time_hour and start_time_minutes(bad design – you don’t need these columns, DATE type has time itself.) you can do this: