查询Oracle数据字典SQL



SELECT
	A.TABLE_NAME AS "表名",
	A.COLUMN_NAME AS "字段名",
	DECODE(
	A.CHAR_LENGTH,
	0,
	DECODE(
	A.DATA_SCALE,
	NULL,
	A.DATA_TYPE,
	A.DATA_TYPE || '(' || A.DATA_PRECISION || ',' || A.DATA_SCALE || ')' 
	),
	A.DATA_TYPE || '(' || A.CHAR_LENGTH || ')' 
	) AS "字段类型",
	A.DATA_DEFAULT AS "默认值",
	A.NULLABLE AS "能否为空",
	B.comments AS "备注" 
FROM
	sys.user_tab_columns A,
	sys.user_col_comments B 
WHERE
	A.table_name = B.table_name 
	AND A.COLUMN_NAME = B.COLUMN_NAME 
	AND A.TABLE_NAME IN ( 'table_name') 
ORDER BY
	A.TABLE_NAME
	
	

posted @ 2023-05-30 13:32  秋水秋色  阅读(108)  评论(0编辑  收藏  举报