如何在 Oracle 中找到命名约束的定义?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/83807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I find the definition of a named constraint in Oracle?
提问by Hank Gay
All I know about the constraint is it's name (SYS_C003415
), but I want to see it's definition.
我所知道的约束只是它的名称 ( SYS_C003415
),但我想看看它的定义。
采纳答案by cagcowboy
Another option would be to reverse engineer the DDL...
另一种选择是对 DDL 进行逆向工程...
DBMS_METADATA.GET_DDL('CONSTRAINT', 'SYS_C003415')
Some examples here....
这里有一些例子......
回答by Hank Gay
Looks like I should be querying ALL_CONSTRAINTS
.
看起来我应该查询ALL_CONSTRAINTS
.
select OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, SEARCH_CONDITION from ALL_CONSTRAINTS where CONSTRAINT_NAME = 'SYS_C003415';
回答by Rakesh
Use following query to get a definition of constraint in oracle:
使用以下查询在 oracle 中获取约束的定义:
Select DBMS_METADATA.GET_DDL('CONSTRAINT', 'CONSTRAINT_NAME') from dual
回答by hamishmcn
Or to see all constaints use SYS.DBA_CONSTRAINTS (If you have the privileges)
或者使用 SYS.DBA_CONSTRAINTS 查看所有约束(如果你有权限)