Now I want to fetch Comments for tables and columns separately in the application from metadata. How can I fetch this details?
For table comments, use [DBA|ALL|USER]_TAB_COMMENTS
view.
Example:
SQL> SELECT table_name,
2 comments
3 FROM dba_tab_comments
4 WHERE owner ='OE'
5 AND table_name='INVENTORIES';
TABLE_NAME COMMENTS
----------- ---------------------------------------------------------------
INVENTORIES Tracks availability of products by product_it and warehouse_id.
For column comments, use [DBA|ALL|USER]_COL_COMMENTS
view.
SQL> SELECT table_name,
2 column_name,
3 comments
4 FROM dba_col_comments
5 WHERE owner ='OE'
6 AND table_name='INVENTORIES';
TABLE_NAME COLUMN_NAME COMMENTS
----------- -------------------- ----------------------------------------------------------------------------
INVENTORIES PRODUCT_ID Part of concatenated primary key, references product_information.product_id.
INVENTORIES WAREHOUSE_ID Part of concatenated primary key, references warehouses.warehouse_id.
INVENTORIES QUANTITY_ON_HAND