tags:

views:

66

answers:

1

hi

i have 2 Date field's in oracle 10g (MyDate and MyTime)

and i need to insert string that contain a date & time

strDate = 04/01/2010 00:00:00

strTime = 01/06/2010 17:20:12

how to insert strDate & strTime to field's MyDate & MyTime

+5  A: 

Hi Gold,

use the to_date function to insert a date in Oracle (the Date datatype has both the "date" and "time" component in Oracle):

INSERT INTO your_table(MyDate, MyTime) VALUES (
   to_date('04/01/2010 00:00:00', 'dd/mm/yyyy hh24:mi:ss'),
   to_date('01/06/2010 17:20:12', 'dd/mm/yyyy hh24:mi:ss')
);
Vincent Malgrat