Adsense Ad

Thursday 25 May 2017

Oracle: ORA-00984 Error Message

ORA-00984 Error Message

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:
Oracle PLSQL
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';

No comments: