Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql ORA-00906:缺少左括号(FK)_Sql_Oracle_Command_Foreign Keys - Fatal编程技术网

Sql ORA-00906:缺少左括号(FK)

Sql ORA-00906:缺少左括号(FK),sql,oracle,command,foreign-keys,Sql,Oracle,Command,Foreign Keys,有什么问题,有人能帮忙吗?请尝试在字段名周围使用括号 alter table booking add constraint fk_customer_id foreign key customer_id references customer (customer_id); 尝试在字段名周围使用parens alter table booking add constraint fk_customer_id foreign key customer_id references custo

有什么问题,有人能帮忙吗?

请尝试在字段名周围使用括号

alter table booking 
add constraint fk_customer_id 
foreign key customer_id 
references customer (customer_id);

尝试在字段名周围使用parens

alter table booking 
add constraint fk_customer_id 
foreign key customer_id 
references customer (customer_id);

您需要在源字段名称周围加括号,并在整个约束周围加括号,作为alter table add(…您在此处的添加…)语法的一部分

alter table booking 
add constraint fk_customer_id 
foreign key (customer_id) 
references customer (customer_id);

修改-只有在添加多个项目时才需要外括号,因此请向andraemc提供正确答案,但请注意可能需要外括号。我总是把它们粘在一起以保持风格一致,所以我永远不会忘记

您需要在源字段名称周围加括号,并在整个约束周围加括号,作为alter table add(…您在此处的添加…)语法的一部分

alter table booking 
add constraint fk_customer_id 
foreign key (customer_id) 
references customer (customer_id);

修改-只有在添加多个项目时才需要外括号,因此请向andraemc提供正确答案,但请注意可能需要外括号。我总是把它们粘在一起以保持风格一致,所以我永远不会忘记

它表示您需要在“FK”中添加一个左括号;由于“fk”只出现一次,因此它必须位于“fk_customer_id”之前,此处应为左侧参数。看,我不是甲骨文的负责人,但外键是否需要大写为外键?@B.ClayShannon,不注册important@B.ClayShannon,不,不,表示需要在“FK”中添加左括号;由于“fk”只出现一次,因此它必须位于“fk_customer_id”之前,此处应为左侧参数。看,我不是甲骨文的负责人,但外键是否需要大写为外键?@B.ClayShannon,不注册important@B.ClayShannon是的,不是