I created this table called LOCATION
by doing this:
CREATE TABLE LOCATION(
POSTCODE VARCHAR(10) PRIMARY KEY,
STREET_NAME VARCHAR(20),
CITY VARCHAR(20));
and when I try to add some date within the table it doesn’t work saying there is an error
INSERT INTO LOCATION VALUES(PQ95VM,'HAPPY_STREET','FRANCE');
error is saying
column not allowed here
![]()
asked May 8, 2012 at 15:18
0
You’re missing quotes around the first value, it should be
INSERT INTO LOCATION VALUES('PQ95VM', 'HAPPY_STREET', 'FRANCE');
Incidentally, you’d be well-advised to specify the column names explicitly in the INSERT, for reasons of readability, maintainability and robustness, i.e.
INSERT INTO LOCATION (POSTCODE, STREET_NAME, CITY) VALUES ('PQ95VM', 'HAPPY_STREET', 'FRANCE');
answered May 8, 2012 at 15:21
skaffmanskaffman
396k96 gold badges814 silver badges768 bronze badges
1
Some time, While executing insert query, we are facing:
Column not allowed here
error. Because of quote might missing in the string parameters. Add quote in the string params and try to execute.
Try this:
INSERT INTO LOCATION VALUES('PQ95VM','HAPPY_STREET','FRANCE');
or
INSERT INTO LOCATION (ID, FIRST_NAME, LAST_NAME) VALUES('PQ95VM','HAPPY_STREET','FRANCE');
http://www.drtuts.com/oracle-error-column-not-allowed-here/
answered Sep 16, 2016 at 15:04
VijayaragavanVijayaragavan
8191 gold badge8 silver badges8 bronze badges
INSERT INTO LOCATION VALUES(PQ95VM,'HAPPY_STREET','FRANCE');
the above mentioned code is not correct because your first parameter POSTCODE is of type VARCHAR(10). you should have used ' '.
try INSERT INTO LOCATION VALUES('PQ95VM','HAPPY_STREET','FRANCE');
![]()
NIMISHAN
1,2573 gold badges19 silver badges29 bronze badges
answered Oct 16, 2017 at 4:44
Hiruni KHiruni K
1712 silver badges9 bronze badges
Like Scaffman said — You are missing quotes.
Always when you are passing a value to varchar2 use quotes
INSERT INTO LOCATION VALUES('PQ95VM','HAPPY_STREET','FRANCE');
So one (‘) starts the string and the second (‘) closes it.
But if you want to add a quote symbol into a string for example:
My father told me: ‘you have to be brave, son’.
You have to use a triple quote symbol like:
‘My father told me: »you have to be brave, son».’
*adding quote method can vary on different db engines
![]()
trumpeter201
8,4473 gold badges17 silver badges24 bronze badges
answered May 29, 2013 at 11:14
![]()
BlueCongaBlueConga
8479 silver badges18 bronze badges
What you missed is " " in postcode because it is a varchar.
There are two ways of inserting.
When you created a table Table created. and you add a row just after creating it, you can use the following method.
INSERT INTO table_name
VALUES (value1,value2,value3,...);
1 row created.
You’ve added so many tables, or it is saved and you are reopening it, you need to mention the table’s column name too or else it will display the same error.
ERROR at line 2:
ORA-00984: column not allowed here
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
1 row created.
answered Jul 28, 2016 at 3:09
![]()
this.shivithis.shivi
3013 silver badges7 bronze badges
I made the error of using the wrong quotation marks. I used double quotes as string delimiters in my value list instead of single quotes.
INSERT INTO MYUSERS VALUES( 'Name', "Surname"); // Wrong
INSERT INTO MYUSERS VALUES( 'Name', 'Surname'); // Correct, Surname must be in single quotes
answered Nov 7, 2021 at 18:12
Peter ChaulaPeter Chaula
3,2962 gold badges26 silver badges31 bronze badges
This error creeps in if we make some spelling mistake in entering the variable name.
Like in stored proc, I have the variable name x and in my insert statement I am using
insert into tablename values(y);
It will throw an error column not allowed here.
![]()
Taryn
240k55 gold badges362 silver badges404 bronze badges
answered May 29, 2013 at 6:52
0
Scanner sc = new Scanner(System.in);
String name = sc.nextLine();
String surname = sc.nextLine();
Statement statement = connection.createStatement();
String query = "INSERT INTO STUDENT VALUES("+'"name"'+","+'"surname"'+")";
statement.executeQuery();
Do not miss to add ‘»—-«‘ when concat the string.
סטנלי גרונן
2,87923 gold badges48 silver badges66 bronze badges
answered Oct 16, 2018 at 16:14
![]()
Try using varchar2 instead of varchar and use this :
INSERT INTO LOCATION VALUES('PQ95VM','HAPPY_STREET','FRANCE');
answered Sep 13, 2020 at 7:30
![]()
While inserting the data, we have to used character string delimiter (' '). And, you missed it (' ') while inserting values which is the reason of your error message. The correction of code is given below:
INSERT INTO LOCATION VALUES(PQ95VM,'HAPPY_STREET','FRANCE');
![]()
DuDa
3,6884 gold badges15 silver badges36 bronze badges
answered Dec 27, 2020 at 12:46
I too got the same error while working with insert command. When i replaced double quotes with single quotes it worked fine
answered Apr 7, 2021 at 6:57
Convert double quotes (» «) to single quotes (‘ ‘)
Example
If you have something like this:
INSERT INTO clients (id, email, country)
VALUES (1, "john@gmail.com", "USA");
Convert it to this:
INSERT INTO clients (id, email, country)
VALUES (1, 'john@gmail.com', 'USA');
answered Apr 26, 2021 at 14:20
![]()
Gabriel ArghireGabriel Arghire
1,6431 gold badge16 silver badges33 bronze badges
If PQ95VM is supposed to be a literal string, then use 'PQ95VM'. If it is a variable, make sure it is declared.
answered Nov 16, 2021 at 11:34
ORA-00984: column not allowed here error that occurs when you try to use a column that is not allowed in a particular area of the sql. The ORA 00984: column not allowed here error occurs when a column is not allowed in the VALUES clause of the insert query, the column name is used in VALUES clause or missing quotes in the insert statement. The VALUES clause should contain values that will be stored in the table. If the column name is specified in the VALUES clause, the insert statement will fail to save the values. The ORA-00984: column not allowed here error occurs if double quotes are used in character or date value. In varchar or date data type values, single quotes should be used.
In the Oracle insert statement, the character string or date value should be enclosed by single quotes. If single quotes are not used in the values or double quotes are used, the insert statement will fail to recognize the string or date value. If the quotations in the insert statement VALUES clause are missing, it will be treated as a column name. The insert statement was unable to store the values in the table. The error ORA-00984: column not allowed here will be thrown.
When this ORA-00984 error occurs
The error ORA-00984: column not allowed here will be thrown if the single quotation in the string value or date value is missing in the VALUES clause of the insert statement. If the double quotation mark is used in the insert statement for a string or date value, the error ORA-00984: column not allowed here will occur.
insert into emp values (1, name);
Error starting at line : 2 in command -
insert into emp values (1, name)
Error at Command Line : 2 Column : 28
Error report -
SQL Error: ORA-00984: column not allowed here
00984. 00000 - "column not allowed here"
Root Cause
In oracle, a string value or a date value is created by enclosed with a single quotation. If a single quotation is missed in a string value and a date value or enclosed with double quotation, oracle will not recognise the string and date. It will be interpreted as a column name. Because a column name is not permitted in the insert statement’s VALUES clause, Oracle will thrown this error
Solution 1
If the VALUES clause of the insert statement has a column name, delete it and replace it with a value. The insert statement was unable to save a column name. If you pass the value of a column in the insert statement, the error ORA-00984: column not allowed here will be resolved.
Problem
CREATE TABLE EMP(
id int,
name VARCHAR2(100)
)
insert into emp values (1, name);
Error report -
SQL Error: ORA-00984: column not allowed here
00984. 00000 - "column not allowed here"
Solution
insert into emp values (1, 'kim');
1 row inserted.
Solution 2
If a single quote is missing in the insert statement’s VALUES clause for a string or date value, the insert statement will fail to recognize the string or date value. The insert statement will fail to store the value in the table. The ORA-00984: column not allowed here will be thrown. The error will be fixed if a single quote mark is placed around a string or date value.
Problem
insert into emp values (1, kim);
Error report -
SQL Error: ORA-00984: column not allowed here
00984. 00000 - "column not allowed here"
Solution
insert into emp values (1, 'kim');
1 row inserted.
Solution 3
In Oracle, the string value or date value should be surrounded by a single quotation. If the string value or date value is surrounded by double quotation marks, Oracle will not recognize it as a string value or date value. The error message ORA-00984: column not allowed here will be shown. The issue will be fixed if the double quotation in the string value or date value is replaced with a single quotation.
Problem
insert into emp values (1, "kim");
Error report -
SQL Error: ORA-00984: column not allowed here
00984. 00000 - "column not allowed here"
Solution
insert into emp values (1, 'kim');
1 row inserted.
Solution 4
The date column in the insert statement should be surrounded by a single quotation. The below example shows with a date example.
Problem
insert into emp values (1, 'kim',2001-01-01 13:15:41);
Error report -
SQL Error: ORA-00984: column not allowed here
00984. 00000 - "column not allowed here"
Solution
insert into emp values (1, 'kim','2001-01-01 13:15:41');
1 row inserted.
I am trying to create a trigger that will update an employee audit table when a row is changed. Using a sequence number to assign a unique identifier to each row as it is created. Need to capture the user ID, date of the change, and the action (update), plus the before image of the row.
CREATE SEQUENCE emp_audit_seq START WITH 10;
Create table emp ( empno NUMBER(4) Primary Key, ename VARCHAR2(10), job VARCHAR2(9), mgr NUMBER(4), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), deptno NUMBER(2));
CREATE TABLE emp_audit (
audit_uid NUMBER(15) Primary Key,
change_date DATE,
change_user VARCHAR2(30),
action CHAR(1),
empno NUMBER(4),
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
deptno NUMBER(2));
CREATE OR REPLACE TRIGGER trig_emp_audit
BEFORE UPDATE ON emp
FOR EACH ROW
BEGIN
INSERT INTO emp_audit
VALUES(emp_audit_seq.nextval, change_date, change_user, action, :old.empno, :old.ename, :old.job, :old.mgr, :old.hiredate, :old.sal, :old.comm, deptno);
END;
/
Warning: Trigger created with compilation errors.
SQL> show errors
Errors for TRIGGER TRIG_EMP_AUDIT:
LINE/COL ERROR
-------- -----------------------------------------------
2/3 PL/SQL: SQL Statement ignored
3/149 PL/SQL: ORA-00984: column not allowed here
Can anyone assist in helping me find what I am doing wrong with the trigger?
Edited by: LostNoob on Aug 25, 2012 2:24 PM

Learn the cause and how to resolve the ORA-00984 error message in Oracle.
Description
When you encounter an ORA-00984 error, the following error message will appear:
- ORA-00984: column not allowed here
Cause
You tried to execute a SQL statement that included a column name where it was not permitted.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
This error most commonly occurs when you try to include a column name in the VALUES clause of a INSERT statement.
For example, if you had tried to use the column named customers in an INSERT statement as follows:
INSERT INTO suppliers (supplier_id, supplier_name) VALUES (1, customer_name);
You would receive the following error message:

You could correct the INSERT statement by including a character value, instead of the column name as follows:
INSERT INTO suppliers (supplier_id, supplier_name) VALUES (1, 'IBM');
Or if you needed to include a column name, you could rewrite the INSERT statement with a sub-select as follows:
INSERT INTO supplier (supplier_id, supplier_name) SELECT account_no, customer_name FROM customers WHERE city = 'Newark';
I am running Oracle 10g. I am writing a script (a delta script over a created database) that will be executed in SQL*Plus. It is needed to fix a bug.
I need to know if a row exist in a table, and if it does not, insert it. So I start like:
BEGIN
DECLARE
COL_EXIST NUMBER(10);
BEGIN
-- Reset ET_SEVERITY_LEVEL
UPDATE ET_SEVERITY_LEVEL
SET ID_SEVERITY_LEVEL = 5
WHERE CODE='FATAL';
UPDATE ET_SEVERITY_LEVEL
SET ID_SEVERITY_LEVEL = 4
WHERE CODE='ERROR';
UPDATE ET_SEVERITY_LEVEL
SET ID_SEVERITY_LEVEL = 3
WHERE CODE='WARNING';
UPDATE ET_SEVERITY_LEVEL
SET ID_SEVERITY_LEVEL = 2
WHERE CODE='INFO';
-- Insert ET_SEVERITY_LEVEL register DEBUG
SELECT COUNT(*) INTO COL_EXIST
FROM ET_SEVERITY_LEVEL
WHERE CODE like 'DEBUG';
IF COL_EXIST = 0 THEN
EXECUTE IMMEDIATE 'INSERT INTO ET_SEVERITY_LEVEL(ID_SEVERITY_LEVEL, CODE, DESCRIPTION) VALUES (1, "DEBUG", "Debugging")';
END IF;
END;
END;
/
But I get the following error:
ORA-00984: column not allowed here
ORA-06512: in line 30
00984. 00000 - "column not allowed here"
*Cause:
*Action:
How could I do this? Is there a way to write a script to query tables and DML at the same time?
![]()
atokpas
8,4661 gold badge15 silver badges27 bronze badges
asked Oct 11, 2012 at 11:43
You need to use escaped single quotes in your EXECUTE IMMEDIATE statement, like so:
EXECUTE IMMEDIATE 'INSERT INTO ET_SEVERITY_LEVEL(ID_SEVERITY_LEVEL, CODE, DESCRIPTION) VALUES (1, ''DEBUG'', ''Debugging'')';
answered Oct 11, 2012 at 11:52
![]()
PhilᵀᴹPhilᵀᴹ
31.2k9 gold badges80 silver badges107 bronze badges
0
Alter you query as instead of writing
VALUES (1, "DEBUG", "Debugging")
you should write
VALUES (1, 'DEBUG', 'Debugging');
dezso
29.9k13 gold badges95 silver badges140 bronze badges
answered May 8, 2017 at 5:27