oracle 错误:ORA-00907:缺少右括号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22467194/
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
Error : ORA-00907: missing right parenthesis
提问by user3428966
I'm trying to create a simple table but it's giving me an error says:
我正在尝试创建一个简单的表,但它给了我一个错误说:
Error starting at line : 1 in command -
CREATE TABLE dj_abonent
(
nr_klienti int NOT NULL,
emer_klienti varchar2(10),
sasia_cel int
CONSTRAINT dj_klientID PRIMARY KEY(nr_klienti)
)
Error at Command Line : 6 Column : 35
Error report -
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Error starting at line : 1 in command -
CREATE TABLE dj_abonent
(
nr_klienti int NOT NULL,
emer_klienti varchar2(10),
sasia_cel int,
CONSTRAINT dj_klientID PRIMARY KEY(nr_klienti)
)
Error at Command Line : 1 Column : 14
Error report -
SQL Error: ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
*Cause:
*Action:
回答by Woot4Moo
You are missing a comma:
你缺少一个逗号:
CREATE TABLE dj_abonent
(
nr_klienti int NOT NULL,
emer_klienti varchar2(10),
sasia_cel int, -- this one right here
CONSTRAINT dj_klientID PRIMARY KEY(nr_klienti)
)
回答by Patrick Hofman
Your have the second error because you use dj_klientID
as name for both of the constraints. They have to be unique.
您有第二个错误,因为您将dj_klientID
两个约束用作名称。它们必须是独一无二的。
Try renaming one of the two constraints and also your second query will be fixed.
尝试重命名两个约束之一,您的第二个查询也将被修复。