Jump to content

Problem creating tables?


Recommended Posts

Im new to sql in Oracle and i hope i have posted this in the correct forum.

 

Im trying to create a new table but not having any luck and i would be greatful if somebody could point me in the right direction.

 

 

 

create table global_locations(id number(6)CONSTRAINT id_global_locations_id NOT NULL,

                              name VARCHAR2(25),

                              date_opened date,

                              address VARCHAR2(50),

                              city VARHCAR2(25),

                              zip/post_code VARCHAR2(10),

                              phone VARCHAR2(20),

                              email VARHCAR2(30),

                              manager_id VARCHAR2(6),

                              emergency_contact VARCHAR2(30),

 

CONSTRAINT global_locations_id_uk UNIQUE(id,manager_id));

 

Error ORA-00907: missing right parenthesis

 

 

 

I have checked and for the life of me can't see the problem.

 

Thanx in advance for any help and again im sorry if this is in the wrong place or format.

Link to comment
Share on other sites

try this

create table global_locations (id number(6) ,
                               name VARCHAR2(25),
                               date_opened date,
                               address VARCHAR2(50),
                               city VARHCAR2(25),
                               zip/post_code VARCHAR2(10),
                               phone VARCHAR2(20),
                               email VARHCAR2(30),
                               manager_id VARCHAR2(6),
                               emergency_contact VARCHAR2(30),CONSTRAINT id_global_locations_id PRIMARY KEY(id),CONSTRAINT global_locations_id_uk UNIQUE(manager_id));

as you are trying to impose two constraints NOT NULL and UNIQUE on same column id which is same as using PRIMARY KEY so I combined it to one constraint.

I think the mistake you have done is using column name as "zip/post_code" so change it using proper naming convention.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.