gpt4 book ai didi

oracle - 哪个 Oracle View 包含所有约束?

转载 作者:行者123 更新时间:2023-12-03 21:41:41 25 4
gpt4 key购买 nike

我正在尝试从 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 View ?

最佳答案

   select * from user_constraints

关于oracle - 哪个 Oracle View 包含所有约束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3786156/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com