benny
benny

Reputation: 17

Insert a new row into oracle sql table with date field

I am a newbie to SQL.

I have a table called

x with fields:
       name,
       id,
       hire_date
       ......

hire_date is in date(01-jun-98) format.

Now i wanted to insert a new row into table x, where:

`the hire_date is in 'mon-dd-yyyy hh:mi:ss' (july-21-2014 13:00:00)format.` 

i tried using to_char, to_date, convert functions but im not successful. Do i have to alter the table x(change the hire_date date type to above mentioned ones) before inserting this new row? I have tried these already

insert into x values( 'james',201,'july-21-2014 13:00:00')

Upvotes: 0

Views: 1520

Answers (1)

neshkeev
neshkeev

Reputation: 6486

Try this:

insert into x 
values( 'james',201,to_date('july-21-2014 13:00:00', 'month-DD-YYYY HH24:MI:SS');

Upvotes: 0

Related Questions