Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ORA-00984: column not allowed here – error at line 1 sql

SQL>CREATE TABLE student(ID INT, Name VARCHAR(20), Percentage INT, 
                         Location VARCHAR(20), DateOfBirth DATE);

SQL> INSERT INTO student(ID, Name, Percentage, Location, DateOfBirth) 
     VALUES(1, "Manthan Koli", 79, "Delhi", "2003-08-20");

Getting this error:

ERROR at line 1:
ORA-00984: column not allowed here

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In Oracle, it is a single quote you use to enclose strings.

Apart from that, Oracle recommends us to use VARCHAR2 instead of VARCHAR2.

Finally, when inserting dates, don’t insert strings – use date literal (as my example shows), or TO_DATE function with appropriate format model.

SQL> CREATE TABLE student
  2  (
  3     ID            INT,
  4     Name          VARCHAR2 (20),
  5     Percentage    INT,
  6     Location      VARCHAR2 (20),
  7     DateOfBirth   DATE
  8  );

Table created.

SQL> INSERT INTO student (ID,
  2                       Name,
  3                       Percentage,
  4                       Location,
  5                       DateOfBirth)
  6       VALUES (1,
  7               'Manthan Koli',
  8               79,
  9               'Delhi',
 10               DATE '2003-08-20');

1 row created.

SQL>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading