Menu

Inserting Date and Time in database

SQL By Feb 06, 2013 No Comments
I want to insert date and time into a field of a Oracle table whose data type is “Date”.

To do so, I have used the below command.

to_date(‘2011/12/12 11:15:00’, ‘yyyy/mm/dd hh24:mi:ss’)

Example:

Table definition: 
create table ATG(local_id varchar2(50) primary key,Last_Sale Date, Last_Sale_Value varchar2(50),Total_12_month_Value  varchar2(50));

In the above table, I want to insert data and time to “Last_Sale field”.

Insert data:

insert into ATG values (‘9986’,to_date(‘2011/12/12 11:15:00’, ‘yyyy/mm/dd hh24:mi:ss’),’£319.99′,’£1,234,96′);

No Comments

Leave a comment

Hi, Welcome here.
JOIN OUR NEWSLETTER
And get notified everytime we publish a new blog post.