Adsense Ad

Thursday 25 May 2017

Oracle: ORA-00928 Error Message

ORA-00928 Error Message

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

Description

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

Cause

You tried to create an Oracle VIEW, but missed the SELECT keyword.

Resolution

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

Option #1

Correct the CREATE VIEW statement and re-execute it.
For example, if you had tried to create a view as follows:
CREATE VIEW sup_orders AS
  suppliers.supplier_id, orders.quantity, orders.price
  FROM suppliers
  INNER JOIN orders
  ON suppliers.supplier_id = orders.supplier_id
  WHERE suppliers.supplier_name = 'IBM';
You would receive the following error message:
Oracle PLSQL
You could correct the CREATE VIEW statement by including the SELECT keyword as follows:
CREATE VIEW sup_orders AS
  SELECT suppliers.supplier_id, orders.quantity, orders.price
  FROM suppliers
  INNER JOIN orders
  ON suppliers.supplier_id = orders.supplier_id
  WHERE suppliers.supplier_name = 'IBM';

No comments: