Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-07-07
7
Medium Priority
?
1,360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 60

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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

610 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