oracle 如何检查oracle sql中的非空列约束?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9526670/
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
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:39:01 来源:igfitidea点击:
how to check for not null column constraint in oracle sql?
提问by serpiente
How do i check if a column in a table has a not null constraint in an oracle db? Can it be checked with the data dictionary?
如何检查表中的列在 oracle 数据库中是否具有非空约束?可以用数据字典查吗?
回答by Justin Cave
SELECT nullable
FROM all_tab_cols
WHERE owner = <<owner of table>>
AND table_name = <<name of table>>
AND column_name = <<name of column>>
will work assuming the column is marked NOT NULL rather than, say, having a CHECK
constraint that checks that it is non-NULL.
假设该列被标记为 NOT NULL 而不是,比如说,有一个CHECK
检查它是非 NULL的约束。