天天看点

# Oracle表结构信息查询(写数据字典用)

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