1. 程式人生 > >匯出oracle使用者下的表的註釋

匯出oracle使用者下的表的註釋

--表字段註釋

SELECT 'comment on column '|| t.table_name||'.'||
t.colUMN_NAME||' is '|| ''''||
t1.COMMENTS ||''' '||';'
FROM User_Tab_Cols t, User_Col_Comments t1
WHERE t.table_name = t1.table_name
AND t.column_name = t1.column_name(+) and t1.COMMENTS is not null;

--表註釋
SELECT distinct 'comment on table '|| t.table_name||' is '|| ''''||
t1.COMMENTS ||''' '||';'
FROM User_Tab_Cols t, user_tab_comments t1
WHERE t.table_name = t1.table_name and t1.COMMENTS is not null;