M.A
M.A

Reputation: 1

ORA-00906: missing left parenthesis (FK)

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

what is the problem, can somebody help?

Upvotes: 0

Views: 1594

Answers (2)

Michael Broughton
Michael Broughton

Reputation: 4055

You need brackets around the source field name, and around the entire constraint as part of the alter table add (..your addition here...) syntax

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

Revise that - the outer brackets are only required if adding more than one item, so give the correct answer to andraemc but be aware of the possible need for outer brackets. I always stick 'em in to keep the style consistent, and so I don't ever forget to!

Upvotes: 1

andreamc
andreamc

Reputation: 656

Try parens around the field name

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

Upvotes: 4

Related Questions