Error : ORA-00907: missing right parenthesis

依然范特西╮ 提交于 2019-12-08 14:20:20

问题


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:

回答1:


Your have the second error because you use dj_klientID as name for both of the constraints. They have to be unique.

Try renaming one of the two constraints and also your second query will be fixed.




回答2:


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)
)


来源:https://stackoverflow.com/questions/22467194/error-ora-00907-missing-right-parenthesis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!