1

I am working with an Oracle database that has a number of tables. I am being asked to generate a table with metadata about these tables, more precisely, I need a table with columns TABLE_NAME (where each row shows the name of a table) and NUMBER_COLUMNS (where each row shows the number of columns in that table).

I am getting the info on the table names from ALL_TABLES but I can't find a way to associate or even find the number of columns for each table. The methods that I've seen, like this one, only give me a row with the cumulative number of tables.

Please help!

1 Answer 1

1

You can do this:

select table_name, owner, count(*) as Number_Columns
from all_tab_cols
group by table_name, owner;
Sign up to request clarification or add additional context in comments.

1 Comment

Probably want to group by owner and table_name if dealing with all_tab_cols in case there is a table with the same name in different schemas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.