一、獲取表字段:
select * from user_tab_columns where Table_Name='用戶表'
user_tab_columns 為當前用戶的columns,除此之外還有all_tab_columns和dba_tab_columns,這兩個多了owner列
select * from all_tab_columns where Table_Name='用戶表' and owner = 'admin'
二、獲取表注釋:
select * from user_tab_comments where Table_Name='用戶表'
同理,還有all_tab_comments 和 dba_tab_comments ,也多了owner列
三、獲取字段注釋:
select * from user_col_comments where Table_Name='用戶表'
同理。。。
四、獲取表所有字段信息及注釋:
SELECT b.column_name columnName --字段名
,b.data_type dataType --字段類型
,b.data_length dataLength --字段長度
,b.data_precision dataPrecision --字段長度
,b.data_scale dataScale --字段長度
,b.NULLABLE nullable --可為空
,a.comments comments --字段注釋
FROM all_col_comments a --注釋表
,all_tab_columns b --列表
WHERE a.table_name = b.table_name and a.OWNER = b.OWNER and a.Column_name = b.Column_name and
a.table_name = '用戶表' and a.OWNER='ADMIN'