Oracle中的表結構匯出到word

梓沐發表於2015-12-23

SELECT t1.table_name   AS "表名稱",

       t3.comments     AS "表說明",

       t1.column_name  AS "欄位名稱",

       t1.data_type    AS "資料型別",

       t1.data_length  AS "長度",

       t1.nullable     AS "是否為空",

       t2.comments     AS "欄位說明",

       t1.data_default "預設值"

  FROM cols t1

  LEFT JOIN user_col_comments t2

    ON t1.table_name = t2.table_name

   AND t1.column_name = t2.column_name

  LEFT JOIN user_tab_comments t3

    ON t1.table_name = t3.table_name

 WHERE NOT EXISTS (SELECT t4.object_name

          FROM user_objects t4

         WHERE t4.object_type = 'TABLE'

           AND t4.temporary = 'Y'

           AND t4.object_name = t1.table_name)

 ORDER BY t1.table_name, t1.column_id;


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

相關文章