整理偶的记事本,发现有如下SQL,看了下,正好是查询table的元数据的SQL,可能别人用得着,hoho
SELECT DECODE(tabnum,1,table_owner,NULL) AS table_owner,
DECODE(tabnum,1,table_name,NULL) AS table_name,
DECODE(tabnum,1,table_comments,NULL) AS table_comments,
col_comments
FROM (
SELECT col.owner AS table_owner,col.TABLE_NAME AS table_name,tab.COMMENTS AS table_comments, col.COMMENTS AS col_comments ,
row_number() OVER (PARTITION BY tab.owner,tab.TABLE_NAME ORDER BY tab.owner) AS tabnum
FROM dba_col_comments col, dba_tab_comments tab
WHERE col.owner=tab.owner
AND col.table_name=tab.table_name
AND col.owner='NINI' AND col.table_name ='TEST_OBJ'
)