How do I query an Oracle database to display the names of all tables in it?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
The following query only list the required data, whereas the other answers gave me the extra data which only confused me.
You can use Oracle Data Dictionary to get information about oracle objects.
You can get list of tables in different ways:
or for example:
Then you can get table columns using table name:
Then you can get list of dependencies (triggers, views and etc.):
Then you can get text source of this objects:
And you can use
USER
orALL
views instead ofDBA
if you want.Including views:
Going one step further, there is another view called cols (all_tab_columns) which can be used to ascertain which tables contain a given column name.
For example:
to find all tables having a name beginning with EST and columns containing CALLREF anywhere in their names.
This can help when working out what columns you want to join on, for example, depending on your table and column naming conventions.
I did not find answer which would point to use
so decided to add my version as well. This view actually returns more that DBA_TABLES as it returns object tables as well (http://docs.oracle.com/cd/E11882_01/server.112/e40402/statviews_1003.htm).
I was looking to get a list of all columns names belonging to a table of a schema sorted by the order of column id.
Here's the query I am using: -