I have created a table

    create table Times ( 
departure date not null, 
arrival date not null, 


and I need to insert date and time in both columns

    insert into Times(departure, arrival) 
values (to_date ('2018-05-02 12:40', '2018-05-02 15:08'))

I get the following error

ORA-00947: not enough values

Is there a way to solve this problem?


You are only inserting one column value, not both. The second parameter in to_date should be the format used by the first parameter, not another date. Your insert should look like this:

insert into times (departure, arrival) values 
  (to_date('2018-05-02 12:40','YYYY-MM-DD HH24:MI'),
   to_date('2018-05-02 15:08','YYYY-MM-DD HH24:MI'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.