tags:

views:

134

answers:

2

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).

A: 

in your insert statement, for your time field, use

  to_date(yourInputParam, 'hh:mi')
akf
+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