阅读量:0
在Oracle中,您可以使用以下SQL语句来查看外键关联的表:
SELECT a.table_name AS foreign_key_table, a.constraint_name AS foreign_key_name, a.column_name AS foreign_key_column, b.table_name AS referenced_table, b.column_name AS referenced_column FROM all_cons_columns a JOIN all_constraints c ON a.constraint_name = c.constraint_name JOIN all_cons_columns b ON c.r_constraint_name = b.constraint_name WHERE c.constraint_type = 'R' ORDER BY a.table_name, a.constraint_name, a.column_name;
此查询将返回外键表、外键名称、外键列、参考表和参考列等信息。您可以根据需要调整查询中的条件和列,以满足您的具体需求。