Insert a date/time value into an Oracle table

I have a date field in an Oracle table and I want to insert a new record. I'm trying to insert a date with a time component into this field, but I'm having some problems.

How can I insert this value into the table.

For example, the value is '3-may-03 21:02:44'

Views: 38

Reply to This

Replies to This Discussion

To insert a date/time value into the Oracle table, you'll need to use the to_date function. The to_date function allows you to define the format of the date/time value.

For example, we could insert the '3-may-03 21:02:44' value as follows:

insert into table_name
(date_field)
values
(to_date('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'));

Reply to Discussion

RSS

Oracle Jobs in US

© 2024   Created by Maisam Agha.   Powered by

Badges  |  Report an Issue  |  Terms of Service