Adsense Ad

Thursday 25 May 2017

Oracle: ORA-00926 Error Message

ORA-00926 Error Message

Learn the cause and how to resolve the ORA-00926 error message in Oracle.

Description

When you encounter an ORA-00926 error, the following error message will appear:
  • ORA-00926: missing VALUES keyword

Cause

You tried to execute a INSERT statement and missed the VALUES keyword.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Try adding the missing VALUES keyword or use a sub-select. Then re-execute the statement.
For example, if you tried to execute the following:
INSERT INTO suppliers;
You would receive the following error message:
Oracle PLSQL
You could correct this error either by adding the missing VALUES keyword, as follows:
INSERT INTO suppliers
(supplier_id, supplier_name)
VALUES
(1000, 'IBM');
OR
You could add a sub-select as follows:
INSERT INTO supplier
(supplier_id, supplier_name)
SELECT account_no, name
FROM customers
WHERE city = 'Newark';

No comments: