-- 查询字段在什么表
select * from all_tab_cols t where t.column_name=‘ABC‘;
-- 查询字段在什么表并且 判断是否是主键
select * from all_tab_cols t left join ( select a.table_name, a.constraint_name, a.column_name, b.constraint_type -- 字段约束类型(P:主键) from user_cons_columns a inner join user_constraints b on a.constraint_name = b.constraint_name -- and b.constraint_type = ‘P‘ ) tc on 1=1 and t.table_name = tc.table_name and t.column_name = tc.column_name where 1=1 and t.column_name = ‘PK_PSNDOC‘ -- 要查询的字段 and tc.constraint_type = ‘P‘ -- 判断是否为主键 ORDER BY t.table_name