SQL

Get a list of all available Tables in your Oracle database


Problem

Get list of database tables

Whether you're new to a database or just forgot a name of a table, you can hope there's an up-to-date documentation or simply ask your database to reveal this information.


Solution

Recipe #1 - query available Oracle tables

There are three different virtual views you can query to get a list of all available tables. Depending you the permissions you've got, you might not be able to query all of them. If one doesn't work, try the next one.

This query returns a complete list of tables:

SELECT owner, table_name FROM dba_tables

In case you can't access this view, try this:

SELECT owner, table_name FROM all_tables

If it still doesn't work, try this, but note that this will return a list of table owned by the current user, not all tables in the database:

SELECT table_name FROM user_tables

Comments




Please sign-in to post a comment