我正在尝试从 user_objects 表中获取 CONSTRAINTS ,如下所示:
select CASE object_type
WHEN 'DATABASE LINK' then 'dblinks'
WHEN 'FUNCTION' then 'functions'
WHEN 'INDEX' then 'indexes'
WHEN 'PACKAGE' then 'packages'
WHEN 'PROCEDURE' then 'procedures'
WHEN 'SEQUENCE' then 'sequences'
WHEN 'TABLE' then 'tables'
WHEN 'TRIGGER' then 'triggers'
WHEN 'VIEW' then 'views'
WHEN 'SYNONYM' then 'synonyms'
WHEN 'GRANT' then 'grants'
WHEN 'CONSTRAINT' then 'constraints'
ELSE object_type
END||'|'||
CASE object_type
WHEN 'DATABASE LINK' then 'DB_LINK'
ELSE object_type
END||'|'||object_name
from user_objects
where object_name not like 'BIN$%'
and object_type not like '%PARTITION'
and object_type not in ('PACKAGE BODY')
order by object_type
;
select distinct object_type
from user_objects
;
但是..... USER_OBJECTS 只有这些类型 FUNCTION
INDEX、PACKAGE、PACKAGE BODY、PROCEDURE、SEQUENCE、TABLE、TRIGGER、VIEW 因为从 user_objects 中选择不同的 object_type;退还了他们。所以这个查询根本没有给我约束。
有没有办法从 Oracle 获得所有约束?我应该使用哪个 Oracle 视图?