问题描述
修改数据库中一张表指定字段的数据,该字段在其他表中也存在,需要同步修改;此时需要统计数据库中所有包含该字段的表。
oracle查询表信息
// 获取表字段
select * from user_tab_columns where Table_Name='用户表';
// 获取表注释
select * from user_tab_comments where Table_Name='用户表';
// 获取字段注释
select * from user_col_comments where Table_Name='用户表';
// 当前用户的表
select table_name from user_tables where table_name = upper('表名');
// 所有用户的表
select table_name from all_tables;
// 包括系统表
select owner,table_name from dba_tables where owner='zfxfzb';
// 查询出用户所有表的索引
select * from user_indexes;
// 查询用户表的索引(非聚集索引):
select * from user_indexes where uniqueness='NONUNIQUE';
// 查询用户表的主键(聚集索引):
select * from user_indexes where uniqueness='UNIQUE';
// 查询表的索引
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name='NODE';
// 查询表的主键
select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' AND cu.table_name = 'NODE';
// 查找表的唯一性约束(包括名称,构成列):
select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name=au.constraint_name and cu.table_name='NODE';
// 查找表的外键
select * from user_constraints c where c.constraint_type = 'R' and c.table_name='STAFFPOSITION';
// 查询外键约束的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键名称
// 查询引用表的键的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名
// 查询一个用户中存在的过程和函数
select object_name,created,status from user_objects where lower(object_type) in ('procedure','function');
// 查询其它角色表的权限
select * from role_tab_privs;
// 查看索引个数和类别
select * from user_indexes where table_name='表名' ;