ba_trainer
asked on
ERROR at line 3: ORA-00907: missing right parenthesis
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
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));
Actually you are missing a comma. The SQL parser is just confused by it.
There needs to be a comma before the CONSTRAINT line.
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));
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
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
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
the (CUSTOMER_NO) is not required because it already knows that you are specifying PRIMARY KEY on the CUSTOMER_NO column of this table
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
mrjoltcola
Open in new window