SQL 修改 Oracle 中的唯一约束

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1731421/
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-01 04:25:05  来源:igfitidea点击:

Modify unique constraint in Oracle

sqloracleconstraintsora-00933

提问by wheleph

I need to update an existing constraint in Oracle database to add a new column there.

我需要更新 Oracle 数据库中的现有约束以在那里添加一个新列。

ALTER TABLE MY_PARTNER_DETAILS 
MODIFY CONSTRAINT UQ_MY_PARTNER_DETAILS
UNIQUE(PARTNER_CODE,PGOOD_CODE,SITE_CODE,PARTNER_PLACEMENT,PARTNER_PARTICIPATION)

Gives the error:

给出错误:

Error at line 1
ORA-00933: SQL command not properly ended

What's the problem with that?

这有什么问题?

回答by Majkel

You should drop and recreate the constraint. modify constraintallows you to change constraint's state not definition.

您应该删除并重新创建约束。modify constraint允许您更改约束的状态而不是定义。

See: Oracle Docs

请参阅:Oracle 文档