Search code examples
sqloracle-databaseselectdata-dictionary

Oracle equivalent of information_schema.tables


I get a "table or view does not exist" error while I try to execute the query below in Oracle:

SQL QUERY

SELECT table_type,
       table_name
FROM information_schema.tables
WHERE table_rows >= 1;

ERROR

ORA-00942: table or view does not exist

How do we query metadata about tables in Oracle?


Solution

  • Oracle indeed doesn't provide the information_schema views, but has its own data dictionary. You can use all_tables to create a similar query:

    SELECT *
    FROM   all_tables
    WHERE  num_rows > 1