Search code examples
oracleoracle11goracle10goracle-sqldevelopermaterialized-views

get the comment of the materialized view


good evening,

which is the table or the select I need to get the comment of a materialized view

the comment adds it like this:

comment on MATERIALIZED VIEW TEST33 is 'hello';

try with:

SELECT t.table_name, t.comments FROM USER_TAB_COMMENTS t WHERE TABLE_NAME = 'TEST33';


SELECT * FROM USER_MVIEWS

I cannot locate the table where this information is stored.

I will appreciate your help.

Thanks a lot.


Solution

  • To get Comments on Materialized view:USER_MVIEW_COMMENTS, for comments on columns in MV: USER_COL_COMMENTS

    --Comments on Materialized view
    SQL>SELECT * FROM user_mview_comments
    WHERE mview_name='CAL_MONTH_SALES_MV'
    
    MVIEW_NAME           COMMENTS
    -------------------- --------------------
    CAL_MONTH_SALES_MV   Monthly total sales
    
    
    
    
    --comments on columns in MV
      SQL>SELECT * FROM user_col_comments
      WHERE table_name='CAL_MONTH_SALES_MV'
    
    TABLE_NAME           COLUMN_NAME          COMMENTS             ORIGIN_CON_ID
    -------------------- -------------------- -------------------- -------------
    CAL_MONTH_SALES_MV   CALENDAR_MONTH_DESC  Monthly Calender                 3
    CAL_MONTH_SALES_MV   DOLLARS              Monthly Total                    3
    

    Links:

    USER_COL_COMMENTS

    USER_MVIEW_COMMENTS

    p.s:-Tested on 19c