Reputation: 19
I am getting ORA-00907: missing right parenthesis
Error while creating a table on oracle
here is what I did:
create table customers(
cust_num number(4),
company varchar2(20),
cust_rep number(3),
credit_limit number(15),
custraint cust_num_pk
primary key(cust_num));
whats wrong ??
Upvotes: 0
Views: 12113
Reputation: 3128
There's nothing called Custraint
. It's Constraint
.
It should be:
create table customers(
cust_num number(4),
company varchar2(20),
cust_rep number(3),
credit_limit number(15),
constraint cust_num_pk primary key(cust_num)
);
Upvotes: 6
Reputation: 46
Check your syntax, see the below statement works fine,
create table customers( cust_num number(4), company varchar2(20),
cust_rep number(3), credit_limit number(15), constraint cust_num_pk
primary key(cust_num));
Upvotes: 0
Reputation: 5225
You can also create a primary key constraint like -
create table customers( cust_num number(4) primary key, company varchar2(20), cust_rep number(3), credit_limit number(15));
This is called column-level constraint definition, while the ones in above posts are known as Table-level constraint definitions.
Both are correct.
Upvotes: 0