Solved

ERROR at line 3: ORA-00907: missing right parenthesis

Posted on 2009-07-07
7
1,349 Views
Last Modified: 2012-05-07
I keep getting the error
ERROR at line 3: ORA-00907: missing right parenthesis
but I don't think that I am missing right parenthesis.
Can anyone help?
Thanks, Beth
CREATE TABLE CUSTOMER                           

  (CUSTOMER_NO NUMBER(8,0) NOT NULL

  CONSTRAINT CUSTOMER_PK PRIMARY KEY(CUSTOMER_NO),                

  CUSTOMER_NAME   VARCHAR2(50) NOT NULL, 

  CUSTOMER_TYPE CHAR(1)

  CONSTRAINT CUST_TYPE 

  CHECK (CUSTOMER_TYPE IN ('B', 'C', 'S')),

  ATTENTION_NAME VARCHAR2(30),

  ADDRESS_1_BILL VARCHAR2(50),

  ADDRESS_2_BILL VARCHAR2(50),

  CITY_BILL VARCHAR2(30),

  STATE_BILL VARCHAR2(20),

  ZIPCODE_BILL NUMBER(5,0),

  COUNTRY_BILL VARCHAR2(30));

Open in new window

0
Comment
Question by:ba_trainer
7 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24799641
Doesn't seem like you are missing any parenthesis to me, but maybe I am also missing something.  This shouldn't matter, but you can try it by removing some of the extra spaces/breaks between variable names and its complete definition.
CREATE TABLE CUSTOMER(

	CUSTOMER_NO NUMBER(8,0) NOT NULL CONSTRAINT CUSTOMER_PK PRIMARY KEY(CUSTOMER_NO),                

	CUSTOMER_NAME VARCHAR2(50) NOT NULL, 

	CUSTOMER_TYPE CHAR(1) CONSTRAINT CUST_TYPE CHECK (CUSTOMER_TYPE IN ('B', 'C', 'S')),

	ATTENTION_NAME VARCHAR2(30),

	ADDRESS_1_BILL VARCHAR2(50),

	ADDRESS_2_BILL VARCHAR2(50),

	CITY_BILL VARCHAR2(30),

	STATE_BILL VARCHAR2(20),

	ZIPCODE_BILL NUMBER(5,0),

	COUNTRY_BILL VARCHAR2(30)

);

Open in new window

0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24799660
Actually you are missing a comma. The SQL parser is just confused by it.

There needs to be a comma before the CONSTRAINT line.
CREATE TABLE CUSTOMER                           

  (CUSTOMER_NO NUMBER(8,0) NOT NULL,

  CONSTRAINT CUSTOMER_PK PRIMARY KEY(CUSTOMER_NO),                

  CUSTOMER_NAME   VARCHAR2(50) NOT NULL, 

  CUSTOMER_TYPE CHAR(1)

  CONSTRAINT CUST_TYPE 

  CHECK (CUSTOMER_TYPE IN ('B', 'C', 'S')),

  ATTENTION_NAME VARCHAR2(30),

  ADDRESS_1_BILL VARCHAR2(50),

  ADDRESS_2_BILL VARCHAR2(50),

  CITY_BILL VARCHAR2(30),

  STATE_BILL VARCHAR2(20),

  ZIPCODE_BILL NUMBER(5,0),

  COUNTRY_BILL VARCHAR2(30));

Open in new window

0
 

Expert Comment

by:jumprooster
ID: 24800342
your primary key constraint which you have defined like:

CUSTOMER_NO NUMBER(8,0) NOT NULL,
  CONSTRAINT CUSTOMER_PK PRIMARY KEY(CUSTOMER_NO),    


should be:

CUSTOMER_NO NUMBER(8,0)
  CONSTRAINT CUSTOMER_PK PRIMARY KEY,    

note: the NOT NULL constaint is not specified for primary keys because primary keys are implicitly not null
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:jumprooster
ID: 24800356
additional note: your code for the primary key PRIMARY KEY(CUSTOMER_NO)

the (CUSTOMER_NO) is not required because it already knows that you are specifying PRIMARY KEY on the CUSTOMER_NO column of this table
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24803393
as commented on your other question:
http://www.experts-exchange.com/Database/Oracle/Q_24551544.html
CREATE TABLE CUSTOMER                           

  ( CUSTOMER_NO NUMBER(8,0) NOT NULL    

  , CUSTOMER_NAME   VARCHAR2(50) NOT NULL

  , CUSTOMER_TYPE CHAR(1)

  , ATTENTION_NAME VARCHAR2(30)

  , ADDRESS_1_BILL VARCHAR2(50)

  , ADDRESS_2_BILL VARCHAR2(50)

  , CITY_BILL VARCHAR2(30)

  , STATE_BILL VARCHAR2(20)

  , ZIPCODE_BILL NUMBER(5,0)

  , COUNTRY_BILL VARCHAR2(30)

  , CONSTRAINT CUSTOMER_PK PRIMARY KEY(CUSTOMER_NO)           

  , CONSTRAINT CUST_TYPE CHECK (CUSTOMER_TYPE IN ('B', 'C', 'S'))

);

Open in new window

0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24805145
Hi Beth, I will point out that you ignored other correct answers in this question, prior to angelIII. For the future it might be a good idea to read all expert's post prior, even if angelIII is your favorite expert (he is mine too! :)  hehehehe)

mrjoltcola

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now