Collins Mugo
Collins Mugo

Reputation: 11

I was entering data into an sql table then this errors occurred

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

Upvotes: 1

Views: 34

Answers (1)

MT0
MT0

Reputation: 168416

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); 

Upvotes: 4

Related Questions