Oracle資料庫查詢表名和欄位的描述資訊SQL指令碼
阿新 • • 發佈:2019-01-26
--查詢欄位型別與名稱描述 select a.Table_name,a.column_name,a.data_type,a.data_length,a.data_precision,a.nullable,a.column_id,b.comments from user_tab_columns a left join user_col_comments b on a.TABLE_NAME=b.table_name and a.COLUMN_NAME=b.column_name --查詢所有表格的名稱 select * from user_tab_comments --組成一個大檢視 create view v_tabview_struct as select a.*,t.column_name,t.comments as column_comments,t.data_type,t.data_length,t.data_precision,t.nullable,t.column_id from user_tab_comments a left join ( select a.Table_name,a.column_name,a.data_type,a.data_length,a.data_precision,a.nullable,a.column_id,b.comments from user_tab_columns a left join user_col_comments b on a.TABLE_NAME=b.table_name and a.COLUMN_NAME=b.column_name ) t on a.TABLE_NAME = t.table_name order by a.table_name,t.column_id