Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List column name for user views in oracle

Tags:

oracle

What is the Query for list the column names for user created views in Oracle?

like image 562
Navaneethan Avatar asked Oct 21 '11 04:10

Navaneethan


People also ask

How can I get column names from a view 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';

How can I see all views in Oracle?

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.

How can I see all columns in Oracle?

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.


2 Answers

SELECT     * FROM     ALL_TAB_COLUMNS WHERE     TABLE_NAME = 'your_view_name' 
like image 43
Geo Avatar answered Oct 22 '22 00:10

Geo


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.

like image 95
Justin Cave Avatar answered Oct 22 '22 00:10

Justin Cave