While writing a procedure, I am stuck at how to insert a VARCHAR2
(which holds only hours and minutes) in a DATE
column (which has to store my time for future reference).
views:
134answers:
2
A:
in your insert statement, for your time field, use
to_date(yourInputParam, 'hh:mi')
akf
2009-06-22 15:07:41
+1
A:
If the input uses the 24-hour clock (e.g. "22:00"):
INSERT INTO desttable (thedate)
SELECT TO_DATE(thevarchar, 'HH24:MI')
FROM sourcetable;
If the input uses a 12-hour clock (e.g. "10:00pm") change the date format to 'HH:MIpm'
.
Jeffrey Kemp
2009-06-23 12:38:23