Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Angry Unanswered: SQL Newb needs easy prob fixed

    heres the code:

    1 CREATE TABLE Part
    2 (
    3 partNo VARCHAR(5) NOT NULL,
    4 partDescription CHAR(30),
    5 partColour NUMBER(3),
    6 partSize NUMBER(3),
    7 partQuantity NUMBER(7),
    8 PRIMARY KEY (partNo)
    9 )
    10 CREATE TABLE Assembly
    11 (
    12 componentPartNo varchar(5),
    13 assembleyPartNo varchar(5),
    14 )

    the problem is after the first table is created any line of code that is run on line 10 gives back:

    CREATE TABLE Assembly
    *
    ERROR at line 10:
    ORA-00922: missing or invalid option

    where am i going wrong?

    cheers LC_A300

  2. #2
    Join Date
    Jan 2004
    Posts
    492

    Re: SQL Newb needs easy prob fixed

    Originally posted by LC_A300
    heres the code:

    1 CREATE TABLE Part
    2 (
    3 partNo VARCHAR(5) NOT NULL,
    4 partDescription CHAR(30),
    5 partColour NUMBER(3),
    6 partSize NUMBER(3),
    7 partQuantity NUMBER(7),
    8 PRIMARY KEY (partNo)
    9 )
    10 CREATE TABLE Assembly
    11 (
    12 componentPartNo varchar(5),
    13 assembleyPartNo varchar(5),
    14 )

    the problem is after the first table is created any line of code that is run on line 10 gives back:

    CREATE TABLE Assembly
    *
    ERROR at line 10:
    ORA-00922: missing or invalid option

    where am i going wrong?

    cheers LC_A300

    You need a semicolon after each table declaration - So after the last parentheses for each table. If you still get an error, put a forward slash ( / ) after the semi-colon, and before the next table declaration.

  3. #3
    Join Date
    Mar 2004
    Posts
    4
    Cheers 4 the reply

    Am using SQL*Plus (should hav said that) and the ; only brings back errors. I think thats got summin to do with self declaration or summin. so i think im not supposed to have ;

  4. #4
    Join Date
    Jan 2004
    Posts
    492
    Originally posted by LC_A300
    Cheers 4 the reply

    Am using SQL*Plus (should hav said that) and the ; only brings back errors. I think thats got summin to do with self declaration or summin. so i think im not supposed to have ;

    Did you try the forward slash (/) too? I havent used SQL PLUS in a while, but I think thats how you separate several SQL commands. If not im sure someone else can shed some light.

  5. #5
    Join Date
    Mar 2004
    Posts
    4
    Yeah i have tried the "/" but to no avail...... it still gives me the same thing error but this time at line 9

    )/
    *
    ERROR at line 9:
    ORA-00922: missing or invalid option

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    PHP Code:
    CREATE TABLE part
     
    (
     
    partno VARCHAR(5NOT NULL,
     
    partdescription CHAR(30),
     
    partcolour NUMBER(3),
     
    partsize NUMBER(3),
     
    partquantity NUMBER(7),
     
    PRIMARY KEY (partno)
     );
    CREATE TABLE assembly
     
    (
     
    componentpartno VARCHAR(5),
     
    assembleypartno VARCHAR(5)
     ); 
    works fine on my Ora9i.

    In other words, your query lacks in semicolon between two CREATE TABLE commands AND you don't need coma after "assembleypartno" as it is the last column in the table.
    Last edited by Littlefoot; 03-22-04 at 09:38.

  7. #7
    Join Date
    Mar 2004
    Posts
    4

    Talking

    Cheers All for the help!

    I seem to have it working..... i was trying to enter two tables at once without the semi colon! ive learned how to use them now!

    thanx all

  8. #8
    Join Date
    Oct 2003
    Posts
    87
    Do partNo, componentPartNo, and assembleyPartNo have both characters and numbers present? If not, varchar is a very poor choice for a . . . partNo and PK.
    Oracle - DB2 - MS Access -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •