Skip to content Skip to sidebar Skip to footer

Sql Developer Insert Data Error

I have no idea why I am getting this error. Does anybody have any ideas? Error starting at line : 19 in command - INSERT INTO Employee (Eno, Ename, Zip, Hdate, Creation_D

Solution 1:

Quote strings with ':

INSERTINTO Employee 
(Eno, Ename, Zip, Hdate, Creation_Date,Created_by, Last_Update_Date, Last_Update_By )
VALUES 
(111111, 'Man', '01234', 'Jan-10-1999','Jan-10-1999', 'Hank', 'Jan-10-1999', 'Hank');

"name" is treated as identifier.

Solution 2:

"Man", "Hank", and "Hank" should be in single quotes, like this: 'Man', 'Hank', and 'Hank'. Character strings inside double-quotes are taken to be quoted column names. That's why the error is column not allowed here.

And while we're on it, if HDate, Creation_Date, and Last_Update_Date are of datatype DATE you're flirting with disaster here by counting on the database interpreting a string as a date in a particular way. Best to use the TO_DATE function to convert the string into a real DATE:

INSERTINTO Employee 
(Eno, Ename, Zip, Hdate,
 Creation_Date,Created_by, Last_Update_Date,
 Last_Update_By )
VALUES 
(111111, 'Man', '01234', TO_DATE('Jan-10-1999''MON-DD-YYYY'),
 TO_DATE('Jan-10-1999', 'MON-DD-YYYY'), 'Hank', TO_DATE('Jan-10-1999', 'MON-DD-YYYY'),
 'Hank')

Best of luck.

Post a Comment for "Sql Developer Insert Data Error"