I'm trying to figure out a way to count the number of columns in a view in Oracle. There's a lot of answers around on how to count the number of columns in a table, but none for views.
The database has many, many views, and I have to count for each one. It would be most efficient to find a solution in the form of a query I can repeatedly execute - hand counting isn't going to work here.
Thanks for any help you can provide!
SELECT
table_name,
column_name,
data_type
FROM all_tab_columns
WHERE table_name = 'VIEWNAME'
AND owner = 'OWNER'
ORDER BY column_id;
for counting
SELECT
count(*) columnCount
FROM all_tab_columns
WHERE table_name = 'VIEWNAME'
AND owner = 'OWNER'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With