SQL - Is It Possible To See The Structure of Mulitple Table With A Single - Desc - Stack Overflow
SQL - Is It Possible To See The Structure of Mulitple Table With A Single - Desc - Stack Overflow
"desc".
Asked 8 years, 9 months ago Modified 4 years, 2 months ago Viewed 615 times
Is it possible to see the structure of multiple table with a single "desc". i have created following table
my_contact, profession, interest,seeking,location etc. but rather then typing "desc" again and again i want
-1 to see the structure of selected table with the single query.
Is it possible in anyway?
sql oracle10g
Share Improve this question Follow asked Feb 17, 2015 at 18:29
user3657714
17
Not with the SQL*Plus describe command, but you can query the data dictionary - depends what you want to see.
– Alex Poole Feb 17, 2015 at 18:32
i simply want to see the structure of the table, not the data they contain – user3657714 Feb 17, 2015 at 18:36
The data dictionary contains the metadata for the tables, not the actual data. See Ben's answer on the question I
linked this to; just change the filter for a single table to a list of tables (with in ) or leave it out to see all tables.
You'll probably want to include the table name in the select list and order by, come to think of it... – Alex Poole Feb
17, 2015 at 18:38
can u please reopen this question. – user3657714 Feb 18, 2015 at 10:30
You can't use the SQL*Plus describe command to get information about more then one object at a time.
On an old question, Ben gave a good overview of how to mimic that client command for a single table by
4
querying the relevant data dictionary view.
To get similar information for more than one table you would need to provide a list of table names, or
omit the table name filter altogether. But you probably also want to include the table name in the select
list so you know which column belongs to which table, and order the results by table name and column
ID, which will mimic the column order as shown by the SQL*Plus describe command.
This expands the data type display from Ben's answer a bit, and should be close to describe for most
data types; but with the addition of the table name:
If you want to see all your tables then exclude the where clause. And if you want to see other people's
tables as well, query all_tab_columns and include the owner in the select list and order by clause; but
then you may want to exclude the built in accounts like SYS.
You could also make this a view or a function if you want to run it often but hide the complexity.
Share Improve this answer Follow edited Aug 30, 2019 at 16:58 answered Feb 18, 2015 at 10:36
Alex Poole
185k 11 181 321
thanks alex for answering my dumb question. i have just started learning oracle sql – user3657714 Feb 18, 2015 at
13:35