musicking123
musicking123

Reputation: 3445

how to hold datetime into a field in oracle?

will date datatype hold datetime? its not taking datetime.

i have to store datetime into a field in table, for that which datatype i have to use?

Thanks, Srikanth

Upvotes: 1

Views: 662

Answers (1)

Kamal
Kamal

Reputation: 2522

The date field does hold date time but you'll need to use the to_date function

for example, if you're trying to insert 2009/01/04 09:00:00 you will use

insert into table_name
(date_field)
values
(to_date('2010/01/04 09:00:00', 'yyyy/mm/dd hh24:mi:ss'));

Note the datetime mask used to tell the field what format the data is arriving in

Upvotes: 4

Related Questions