Oracle表結構資訊查詢(寫資料字典用)
SELECT
t1.COLUMN_ID,
t2.COMMENTS,
t1.COLUMN_NAME,
t1.DATA_TYPE,
t1.DATA_LENGTH
FROM
ALL_TAB_COLUMNS t1
JOIN user_col_comments t2 ON t1.COLUMN_NAME = t2.COLUMN_NAME
WHERE
t1.TABLE_NAME = 'BT_CLEAR_UNIONTRANS' AND t2.TABLE_NAME = 'BT_CLEAR_UNIONTRANS'
GROUP BY t1.COLUMN_ID,t2.COMMENTS,t1.COLUMN_NAME, t1.DATA_TYPE, t1.DATA_LENGTH
ORDER BY
t1.COLUMN_ID