oracle獲取表字段及表注釋的相關操作


一、獲取表字段:

    select *  from user_tab_columns where Table_Name='用戶表' 

 

user_tab_columns 為當前用戶的columns,除此之外還有all_tab_columnsdba_tab_columns,這兩個多了owner

 select *  from all_tab_columns where Table_Name='用戶表'  and owner = 'admin'

 

二、獲取表注釋:

select * from user_tab_comments where Table_Name='用戶表'

 

同理,還有all_tab_commentsdba_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'


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM