select * from all_constraints x where table_name in (select table_name from all_tables where tablespace_name = 'MYTABLESPACE') and exists ( select 1 from all_constraints where r_owner = x.owner and r_constraint_name = x.constraint_name and table_name not in (select table_name from all_tables where tablespace_name = 'MYTABLESPACE'));这段代码是找出某个tablespace中被其他表空间中的表关联了的主键名称。
要删除此表,之前要先删除相关联的表,或用descade。
from all_constraints x
where table_name in (select table_name
from all_tables
where tablespace_name = 'MYTABLESPACE')
and exists (
select 1
from all_constraints
where r_owner = x.owner
and r_constraint_name = x.constraint_name
and table_name not in (select table_name
from all_tables
where tablespace_name = 'MYTABLESPACE'));这段代码是找出某个tablespace中被其他表空间中的表关联了的主键名称。