Oracle · error reference

ORA-00942: table or view does not exist

ORA-00942: table or view does not exist

Oracle's most-searched error, and usually not about a missing table at all — it is about privileges, schema qualification, or a DROP that has no IF EXISTS.

What the database is telling you

The name did not resolve for this user. Oracle deliberately does not distinguish 'no such table' from 'exists, but you may not see it', so a missing object and a permissions problem produce identical messages.

Why it shows up in a migration

Two cases dominate. First, a DDL statement failed earlier — very often on clause order — so the table was never created, and the load reports a missing table rather than the real error. Always read the first failure, not the loudest one. Second, Oracle has no DROP TABLE IF EXISTS, so any idempotent teardown raises this on a clean database, where it means nothing at all.

Common causes

  • An earlier CREATE TABLE failed and this is the downstream symptom.
  • The table belongs to another schema and is not qualified or aliased.
  • The connecting user has no SELECT privilege on it.
  • A DROP TABLE on a database where it was never created.
  • A case-sensitive name created with quotes and referenced without them.

How to fix it

  1. 1

    Check whether it exists at all, and under whose schema.

    SELECT owner, object_type FROM all_objects WHERE object_name = 'ORDERS';
  2. 2

    Wrap DROP in a block that ignores only this error, so teardown is idempotent without hiding anything else.

    BEGIN
      EXECUTE IMMEDIATE 'DROP TABLE orders CASCADE CONSTRAINTS';
    EXCEPTION WHEN OTHERS THEN
      IF SQLCODE != -942 THEN RAISE; END IF;
    END;
  3. 3

    Grant the privilege, or create a synonym, if it exists under another owner.

    GRANT SELECT ON app.orders TO reporting_user;

What DBShifts does about it

Generated Oracle teardown uses exactly the block above — it re-raises every SQLCODE except -942, so dropping a table that was never there is silent while a permissions failure is not. DDL failures are also reported before the data load is attempted, so the first error you see is the real one rather than this one.

Bulk transfer engine

Migrating between engines?

DBShifts converts the schema, moves the data, and then proves the two sides match with a type-aware checksum per table — not just a row count. Errors like this one are handled on the way, and the ones that cannot be handled are reported rather than logged and forgotten.

Related errors

← All database errors