What is the Query for list the column names for user created views in Oracle?
To select column names of a given table you can use the following query: Select column_name from user_tab_cols where table_name =3D'TABLE_NAME';
ALL_VIEWS describes the views accessible to the current user. DBA_VIEWS describes all views in the database. USER_VIEWS describes the views owned by the current user. This view does not display the OWNER column.
ALL_TAB_COLUMNS describes the columns of the tables, views, and clusters accessible to the current user. To gather statistics for this view, use the ANALYZE SQL statement or the DBMS_STATS package. DBA_TAB_COLUMNS describes the columns of all tables, views, and clusters in the database.
SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'your_view_name'
SELECT table_name, column_name, data_type FROM all_tab_columns WHERE table_name = 'VIEWNAME' AND owner = 'OWNER' ORDER BY column_id
You can also use USER_TAB_COLUMNS
and/or DBA_TAB_COLUMNS
depending on your privileges and whether you have permission to query the view.
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