Oracle table select

yhj20041128001發表於2022-05-25

ORACLE匯出資料庫所有表結構為EXCEL檔案(只需要把資料庫名改為對應的資料庫即可,需要單個的話,在Where中加入atc.table_name為單表即可):


SELECT DISTINCT

atc.table_name AS "表名"

,atcom.comments AS "表註釋"

,atc.column_id AS "欄位序號"

,atc.column_name AS "欄位名"

,atc.data_type AS "欄位型別"

,atc.data_scale AS "欄位精度"

,atc.data_length AS "欄位長度"

,acc.comments AS "欄位註釋"

,allt.num_rows as "表資料量"

FROM

all_tab_columns atc

INNER join all_col_comments acc ON atc.table_name = acc.table_name AND atc.owner = acc.owner AND atc.column_name = acc.column_name

INNER join all_tab_comments atcom ON atc.table_name = atcom.table_name AND atcom.owner = acc.owner AND atcom.table_type = 'TABLE'

INNER join all_tables allt on atc.table_name = allt.table_name AND atc.owner = allt.owner

WHERE

atc.owner = '資料庫名'

ORDER BY

atc.table_name,

atc.column_id;


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

相關文章