Search code examples
oracle

List column name for user views in oracle


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


Solution

  • 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.