ORACLE 查询表信息

--oracle库
select * from tabs --查你所在用户下的表 =select * from user_tables
select * from all_tables where owner='VTATEST'; --查某个用户下的所有表
SELECT * FROM USER_TABLES order by TABLE_NAME --查询数据库下所有表名
select column_name,data_type,data_length,DATA_PRECISION ,DATA_SCALE from all_tab_columns where table_name = UPPER('test');
--查询指定表里字段及字段注释
select * from user_tab_columns where Table_Name=UPPER('test'); --获取表字段
select * from user_tab_comments where table_name=UPPER('test') order by TABLE_NAME; --查询所有表及表注释
select * from user_tab_comments where comments like '%日志%'order by TABLE_NAME
select * from user_col_comments --获取字段注释
select COLUMN_NAME,COMMENTS from user_col_comments where TABLE_NAME = UPPER('test'); --查询表字段及字段注释
select TABLE_NAME,COLUMN_NAME,COMMENTS from USER_COL_COMMENTS where TABLE_NAME = UPPER('test');--查表字段注释
-- 字段注释 合成1列 字段为STR
select COLUMN_NAME || ' ' || COMMENTS STR
from USER_COL_COMMENTS
where TABLE_NAME = UPPER('test')
order by COLUMN_NAME;
-- 通过字段注释 查询是否存在想要的字段
select tc.TABLE_NAME, cc.column_name,cc.comments,tc.DATA_TYPE,tc.DATA_LENGTH
from user_tab_columns tc
left join user_col_comments cc on cc.table_name = tc.TABLE_NAME and cc.column_name = tc.COLUMN_NAME
where cc.comments like '%充值%';

前途是光明的,道路是曲折的,这是人们常说的一句话,事实也的确如此,不经历风雨哪能见彩虹。前行的路必然不会一路平坦,但只要方向正确,只要还有毅力,还能坚持下去,就要继续前进。唯有这样才能创造属于自已的奇迹。
原文地址:https://www.cnblogs.com/kelly1314/p/15687723.html