1
SQL> insert into sacco values(5647899,'Gabriel Omondi',28-jul-11,'male','kisumu',45000);
values(5647899,'Gabriel Omondi',28-jul-11,'male','kisumu',45000)
                               *

ERROR on line 2:

ORA-00984: column not allowed here

1
  • 2
    you may need to put 28-jul-11 in quotes Commented May 17, 2021 at 8:40

1 Answer 1

4
insert into sacco
values(5647899,'Gabriel Omondi',28-jul-11,'male','kisumu',45000); 

28-jul-11 is being parsed as the number 28 then subtract - the column jul then subtract - the number 11.

You need to use single quotes to show it is a text literal:

insert into sacco
values(5647899,'Gabriel Omondi','28-jul-11','male','kisumu',45000); 

However, while it will work, that is bad practice as you are relying on an implicit cast from a string to a date. A better solution is to use a date literal:

insert into sacco
values(5647899,'Gabriel Omondi', DATE '2011-07-28','male','kisumu',45000); 
Sign up to request clarification or add additional context in comments.

1 Comment

of course that is assuming that the receiving column is defined as a DATE. Of course, if the table is properly designed, it would be defined as a DATE, but we don't know that it is, so a caveat is called for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.