前端之家收集整理的这篇文章主要介绍了
Oracle数据库查询表名和字段的描述信息SQL脚本,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
--查询字段类型与名称描述
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,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