匯出Oracle中的所有表和欄位的註釋

xypincle發表於2017-02-19

  1. --生成所有表的註釋
  2. SELECT 'comment on table '||a.owner||'.'||a.table_name||' is '||''''||a.comments||''''||' ;' FROM Dba_Tab_Comments a
  3. WHERE a.table_type IN ('TABLE','VIEW') AND
  4. a.owner IN ('ACCT','APPQOSSYS','BILLSERVICE','BLDBANK','COMM','CPR','DIALYSIS','ECONSTAT','EMERGOB','EQUIPMENT',
  5. 'EXAM','EXFSYS','FLOWS_030000','FLOWS_FILES','HISUSER','IMESSAGE','INFECT','INPADM','INPBILL','INQUIRE','INSURANCE',
  6. 'IX','KBS','LAB','MDSYS','MEDADM','MEDREC','MHIS','MOBILE','MOTES','NURSING','OLAPSYS','ORDADM','ORDDATA','ORDSYS',
  7. 'OUTLN','OUTPADM','OUTPBILL','OUTPDOCT','PHARMACY','PHYEXAM','SCOTT','SSXT','SURGERY','TJHISRPT','TJRIS','TSMSYS') ;

  8. --生成所有欄位的註釋
  9. SELECT 'comment on column '||a.owner||'.'||a.table_name||'.'||a.column_name||' is '||''''||a.comments||''''||' ;' FROM Dba_Col_Comments a
  10. WHERE a.owner IN ('ACCT','APPQOSSYS','BILLSERVICE','BLDBANK','COMM','CPR','DIALYSIS','ECONSTAT','EMERGOB','EQUIPMENT',
  11. 'EXAM','EXFSYS','FLOWS_030000','FLOWS_FILES','HISUSER','IMESSAGE','INFECT','INPADM','INPBILL','INQUIRE','INSURANCE',
  12. 'IX','KBS','LAB','MDSYS','MEDADM','MEDREC','MHIS','MOBILE','MOTES','NURSING','OLAPSYS','ORDADM','ORDDATA','ORDSYS',
  13. 'OUTLN','OUTPADM','OUTPBILL','OUTPDOCT','PHARMACY','PHYEXAM','SCOTT','SSXT','SURGERY','TJHISRPT','TJRIS','TSMSYS') ;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28878983/viewspace-2133892/,如需轉載,請註明出處,否則將追究法律責任。

相關文章