2

When I write this, I am receiving the error "ORA-00911: invalid character" and I can't see this character. The code works fine up until the ALTER TABLE, that's where this character is.

    CREATE TABLE tbl_orders
    (Order_ID NUMBER NOT NULL,
    Customer_ID NUMBER NOT NULL,
    Order_Date DATE NOT NULL,
    Order_Method VARCHAR2(8) CHECK (Order_Method IN ('Internet','Phone','Mail')),
    Sub_Total NUMBER NOT NULL,
    Delivery_Charge NUMBER NOT NULL,
    Dispatch_Date DATE NOT NULL,
    Carrier_ID NUMBER NOT NULL,
    Grand_Total NUMBER NOT NULL,
    CONSTRAINT tbl_orders_pk PRIMARY KEY (Order_ID));
    ALTER TABLE tbl_orders ADD CONSTRAINT tbl_orders_fk FOREIGN KEY (Customer_ID) REFERENCES tbl_customers (Customer_ID);
    ALTER TABLE tbl_orders ADD CONSTRAINT tbl_orders_fk2 FOREIGN KEY (Carrier_ID) REFERENCES tbl_carriers (Carrier_ID);

All help will be greatly appreciated! Thanks

hickipedia
  • 21
  • 1
  • 2
  • 1
    How and where are you running this? Through SQL*Plus or SQL Developer it would be fine. It looks like you're trying to run it as a single statement (e.g. as a single JDBC call), and it's correctly saying the semicolons are not valid. Using those as statement separators is client-specific, and certainly not allowed for JDBC, or dynamic SQL. I believe APEX doesn't allow it either. – Alex Poole Jul 30 '13 at 11:48
  • Right I see, I was using APEX. I will use SQL Developer from now. Thanks for your help! – hickipedia Jul 30 '13 at 12:17
  • According to [this forum thread](https://forums.oracle.com/thread/2424576), you can do this in APEX, but from Home > SQL Workshop > SQL Scripts. I thought this had been answered here before but I can't find it... – Alex Poole Jul 30 '13 at 12:31

1 Answers1

1

You have to remove the trailing semi colons at the end of your code.

m0butt
  • 21
  • 6