查询所有表名:
select t.table_name from user_tables t;
查询所有字段名:
select t.column_name from user_col_comments t;
查询指定表的所有字段名:
select t.column_name from user_col_comments t where t.table_name = 'BIZ_DICT_XB';
查询指定表的所有字段名和字段说明:
select t.column_name, t.column_name from user_col_comments t where t.table_name = 'BIZ_DICT_XB';
查询所有表的表名和表说明:
select t.table_name,f.comments from user_tables t inner join user_tab_comments f on t.table_name = f.table_name;
查询模糊表名的表名和表说明:
select t.table_name from user_tables t where t.table_name like 'BIZ_DICT%';
select t.table_name,f.comments from user_tables t inner join user_tab_comments f on t.table_name = f.table_name where t.table_name like 'BIZ_DICT%';
--查询表的数据条数、表名、表注释
select a.num_rows, a.TABLE_NAME, b.COMMENTS
from user_tables a, user_tab_comments b
WHERE a.TABLE_NAME = b.TABLE_NAME
order by TABLE_NAME;
转载自:https://www.cnblogs.com/hyq0002013/p/5948419.html
oracle 查询一张表或者视图的建表/视图语句:
select dbms_metadata.get_ddl('类型','名称') from dual ;
类型:view ,table
名称:写表/视图名字
转载自:https://blog.youkuaiyun.com/xiaowen_1990/article/details/79268355
oracle 查询当前用户下的表名 + 表注释
select t.table_name tableName, f.comments comments
from user_tables t
inner join user_tab_comments f
on t.table_name = f.table_name
oracle 查询某表的所有字段 + 字段注释 + 字段类型
SELECT t.TABLE_NAME tableName,
t.COLUMN_NAME columnName,
t.DATA_TYPE dataType,
a.COMMENTS
FROM USER_TAB_COLUMNS t
LEFT JOIN USER_COL_COMMENTS a
ON t.table_name = a.table_NAME
AND t.COLUMN_NAME = a.COLUMN_NAME