Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    London
    Posts
    8

    Unanswered: help: error creating a simple table

    Hi i keep getting an error message while creating this table.

    "missing or invalid option"

    Can anyone help

    jay

    i'm using oracle 8

    CREATE TABLE BOOKINGS
    (BOOKING_ID NUMBER(6) CONSTRAINT pk_bookings_booking_id PRIMARY KEY,
    BOOKING_DATE DATE,
    STOCK_AVAILIBILITY VARCHAR2(3) nn_bookings_stock_availibility NOT NULL,
    STAFF_ID NUMBER(4) CONSTRAINT FK_bookings_staff_id REFERENCES STAFF_MEMBER(STAFF_ID),
    ACCOUNT_ID NUMBER(6) CONSTRAINT fk_bookings_billing_id REFERENCES BILLING_ACCOUNT(BILLING_ID),
    DATE_REQUIRED DATE,
    DATE_DUE DATE,
    DATE_RETURNED DATE,
    CONDITION VARCHAR2(20),
    REPAIR_COST NUMBER(6,2),
    AMOUNT_DUE NUMBER(6,2)));

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: help: error creating a simple table

    You missed the word CONSTRAINT here:

    STOCK_AVAILIBILITY VARCHAR2(3) CONSTRAINT nn_bookings_stock_availibility NOT NULL,

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    I took out all the constraint stuff and extra hooplah and it worked.

    I personally like to create all my PKs and FKs in seperate create clauses.
    For one, like this case, it makes everything a heck of a lot easier to debug.

    You have too many right-params at the end of your statement.
    Also, this line looked strange to me:
    "STOCK_AVAILIBILITY VARCHAR2(3) nn_bookings_stock_availibility NOT NULL,"

    PHP Code:
      1  CREATE TABLE BOOKINGS (
      
    2     BOOKING_ID NUMBER(6),
      
    3     BOOKING_DATE DATE,
      
    4     STOCK_AVAILIBILITY VARCHAR2(3NOT NULL,
      
    5     STAFF_ID NUMBER(4),
      
    6     ACCOUNT_ID NUMBER(6),
      
    7     DATE_REQUIRED DATE,
      
    8     DATE_DUE DATE,
      
    9     DATE_RETURNED DATE,
     
    10     CONDITION VARCHAR2(20),
     
    11     REPAIR_COST NUMBER(6,2),
     
    12*    AMOUNT_DUE NUMBER(6,2))
    08:57:36 platform@kod1> /

    Table created
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Sep 2003
    Posts
    156

    Re: help: error creating a simple table

    Originally posted by StJason
    Hi i keep getting an error message while creating this table.

    "missing or invalid option"

    Can anyone help

    jay

    i'm using oracle 8

    CREATE TABLE BOOKINGS
    (BOOKING_ID NUMBER(6) CONSTRAINT pk_bookings_booking_id PRIMARY KEY,
    BOOKING_DATE DATE,
    STOCK_AVAILIBILITY VARCHAR2(3) nn_bookings_stock_availibility NOT NULL,
    STAFF_ID NUMBER(4) CONSTRAINT FK_bookings_staff_id REFERENCES STAFF_MEMBER(STAFF_ID),
    ACCOUNT_ID NUMBER(6) CONSTRAINT fk_bookings_billing_id REFERENCES BILLING_ACCOUNT(BILLING_ID),
    DATE_REQUIRED DATE,
    DATE_DUE DATE,
    DATE_RETURNED DATE,
    CONDITION VARCHAR2(20),
    REPAIR_COST NUMBER(6,2),
    AMOUNT_DUE NUMBER(6,2)));

    you should have the other tables created - it is also a good idea to use the same col name for the primary key and foreign key values so you don't get lost ie.

    CREATE TABLE staff_members
    (staff_id NUMBER(5) PRIMARY KEY);

    CREATE TABLE billing_acc
    (account_id NUMBER(5) PRIMARY KEY);

    CREATE TABLE bookings
    (
    BOOKING_ID NUMBER NOT NULL,
    BOOKING_DATE DATE,
    STOCK_AVAILIBILITY VARCHAR2(3) NOT NULL,
    STAFF_ID NUMBER (5),
    ACCOUNT_ID NUMBER (5) ,
    DATE_REQUIRED DATE,
    DATE_DUE DATE,
    DATE_RETURNED DATE,
    CONDITION VARCHAR2(20),
    REPAIR_COST NUMBER (6,2),
    AMOUNT_DUE NUMBER (6,2),
    CONSTRAINT PK_bookings PRIMARY KEY (BOOKING_ID ),
    CONSTRAINT staff_id_fk FOREIGN KEY (staff_id) REFERENCES staff_member(staff_id),
    CONSTRAINT bill_acc_fk FOREIGN KEY (account_id) REFERENCES billing_acc(account_id)
    );
    Last edited by GhostMan; 01-19-04 at 10:09.
    rgs,

    Ghostman

  5. #5
    Join Date
    Jan 2004
    Location
    London
    Posts
    8

    THANKS

    Hi

    Thanks guys for your help. Finally got it working.

    Jay

Posting Permissions

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