ORA-00907: missing right parenthesis ???

Discussion in 'Databases' started by nvidia, Jan 14, 2007.

  1. #1
    Hi i am trying to creat a table called item with the following code:

    
    -Creation of Item Table
    DROP TABLE ITEM CASCADE CONSTRAINTS;
    CREATE TABLE ITEM(
    ITEMID  NUMBER (6)      NOT NULL,
    ITEMDESC VARCHAR2 (30)  NOT NULL
    CATEGORY VARCHAR2 (25),
    );
    
    Code (markup):
    I get this error message:

    
    SQL> @table.sql
    DROP TABLE ITEM CASCADE CONSTRAINTS
               *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    
    CATEGORY VARCHAR2 (25),
    *
    ERROR at line 4:
    ORA-00907: missing right parenthesis
    
    Code (markup):
    Ok, when i go to line 4 take into account i have a comment at first line, 'ITEMDESC VARCHAR2 (30) NOT NULL' and add a comma which is now
    'ITEMDESC VARCHAR2 (30) NOT NULL,' i get a different error message:
    
    SQL> @table.sql
    DROP TABLE ITEM CASCADE CONSTRAINTS
               *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    
    )
    *
    ERROR at line 5:
    ORA-00904: invalid column name
    
    Code (markup):
    Question, how do i know when to add a comma and not when to add a comma, because i do not understand why i have the first and second error message afte i added the (,)??:confused:
     
    nvidia, Jan 14, 2007 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    drop table if exists `ITEM`;
    CREATE TABLE `ITEM`(
    ITEMID NUMBER (6) NOT NULL,
    ITEMDESC VARCHAR2 (30) NOT NULL,
    CATEGORY VARCHAR2 (25),
    );

    You missed a comma after
    ITEMDESC VARCHAR2 (30) NOT NULL
     
    maiahost, Jan 14, 2007 IP
  3. nvidia

    nvidia Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i used your code but i get an error:
    
    SQL> @table.sql
    drop table if exists `ITEM`
                  *
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    
    
    CREATE TABLE `ITEM`(
                 *
    ERROR at line 1:
    ORA-00911: invalid character
    
    Code (markup):
    Does any1 know why my code does not work??
     
    nvidia, Jan 14, 2007 IP
  4. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #4
    OK remove the `` and try again
     
    maiahost, Jan 14, 2007 IP