SQL實現查看錶結構以及表註釋(comments)
阿新 • • 發佈:2019-01-02
查看錶結構:
看欄位名與資料型別
select * from cols WHERE TABLE_name=upper( 'table_name ')
檢視主鍵:
select * from user_constraints where constraint_type= 'P '
and TABLE_name=upper( 'table_name ')
另外:
在SQLPLUS中,用 desc tablename
在PL/SQL工具中,可以通過檢視user_tab_columns 檢視
select * from user_tab_columns where table_name = upper('tablename')
檢視備註:
--查看錶的comment
select * from all_tab_comments where table_name= upper('tablename') ;
--檢視列的comment
select * from all_col_comments where table_name=upper('tablename') ;