Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Oracle SQL: Missing right parentheses error? Um...no?

I'm trying to run a script in Oracle 10g XE.

Most of the script executes fine, but I get the "missing right parentheses" error on this.

CREATE TABLE CUSTOMER(

CUST_CODE NUMBER NOT NULL,

CUST_NAME VARCHAR(35) NOT NULL,

CUST_PHONE NUMBER NOT NULL,

CUST_ADDRESS VARCHAR(35) NOT NULL

BID_ID NUMBER NOT NULL)

PRIMARY KEY (CUST_CODE);

INSERT INTO CUSTOMER VALUES (1000, 'AL Brown', '5555551111', '110 Pacific St');

INSERT INTO CUSTOMER VALUES (1001, 'Chris Doty', '5555552222', '220 Center St');

INSERT INTO CUSTOMER VALUES (1002, 'Ellen Frank', '5555553333', '330 Q ST');

INSERT INTO CUSTOMER VALUES (1003, 'Greg Horn', '5555554444', '440 Harrison St');

I don't see where the parentheses is missing.

And then I get errors for these dates:

INSERT INTO ACC_RCV VALUES(1000, 625.00, '06-APR-2012',' ', 5004, 18001, 1000);

INSERT INTO ACC_RCV VALUES(1001, 500.00, '03-APR-2012', ' ', 5003, 18002, 1001);

But not these dates:

INSERT INTO ACC_RCV VALUES(1002, 00.00, '04-APR-2012',' 6-MAR-2012', 5002, 18003, 1002);

INSERT INTO ACC_RCV VALUES(1003, 00.00, '28-MAR-2012','4-MAR-2012', 5001, 18004, 1003);

lolwut?

Update:

Toby..

BID_ID NUMBER NOT NULL)

Is that not a closing parentheses?

5 Answers

Relevance
  • 9 years ago
    Favorite Answer

    The final parenthesis is misplaced on the table creation and you are missing a comma. Try this:

    CREATE TABLE CUSTOMER(

    CUST_CODE NUMBER NOT NULL,

    CUST_NAME VARCHAR(35) NOT NULL,

    CUST_PHONE NUMBER NOT NULL,

    CUST_ADDRESS VARCHAR(35) NOT NULL,

    BID_ID NUMBER NOT NULL,

    PRIMARY KEY (CUST_CODE)

    );

    The PRIMARY KEY clause appears just like a column, so the last column definition needs a "," and the final parenthesis is at the end (after the primary key).

    So obviously the inserts in that table fail. But then again, they fail anyway if the table is created:

    SQL> INSERT INTO CUSTOMER VALUES (1000, 'AL Brown', '5555551111', '110 Pacific St');

    INSERT INTO CUSTOMER VALUES (1000, 'AL Brown', '5555551111', '110 Pacific St')

    *

    ERROR at line 1:

    ORA-00947: not enough values

    Your table has 5 columns, but your insert has only 4. Hence the error. You are missing values for BID_ID. Inserting like that, without listing the columns explicitly is bad practice, since you are assuming that the columns in the table are in the same order as your insert. It is much better to explicitly list the colum names.This also lets you leave BID_ID empty. Like this:

    INSERT INTO CUSTOMER(CUST_CODE, CUST_NAME, CUST_PHONE, CUST_ADDRESS) VALUES (1000, 'AL Brown', '5555551111', '110 Pacific St');

    Except this will not work either. You will get the following error:

    ORA-01400: cannot insert NULL into ("SCOTT"."CUSTOMER"."BID_ID")

    which makes sense since you have a NOT NULL constraint for BID_ID, i.e. you MUST provide a value.

    As for this insert failing:

    INSERT INTO ACC_RCV VALUES(1000, 625.00, '06-APR-2012',' ', 5004, 18001, 1000);

    you did not provide the table definition, and you did not even bother to give the error message you have. I would venture a guess that yiou have two dates, both mandatory (with a NOT NULL constraint) and therefore the empty date ('') - considered a NULL date - causes the error.

  • gains
    Lv 4
    4 years ago

    Oracle Sql Right

  • 6 years ago

    This Site Might Help You.

    RE:

    Oracle SQL: Missing right parentheses error? Um...no?

    I'm trying to run a script in Oracle 10g XE.

    Most of the script executes fine, but I get the "missing right parentheses" error on this.

    CREATE TABLE CUSTOMER(

    CUST_CODE NUMBER NOT NULL,

    CUST_NAME VARCHAR(35) NOT NULL,

    CUST_PHONE NUMBER NOT NULL,

    CUST_ADDRESS VARCHAR(35)...

    Source(s): oracle sql missing parentheses error um no: https://tinyurl.im/uhTIN
  • 5 years ago

    Missing Right Parenthesis

  • How do you think about the answers? You can sign in to vote the answer.
  • Toby
    Lv 7
    9 years ago

    I don't see a matching paren for the first line:

    CREATE TABLE CUSTOMER(

    You never close that off...

Still have questions? Get your answers by asking now.