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
In Oracle, it is a single quote you use to enclose strings (as specified in the SQL standard).
Apart from that, Oracle recommends us to use VARCHAR2
instead of VARCHAR
.
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>