SQL错误:表名无效

时间:2016-04-14 17:48:22

标签: sql oracle

我正在尝试使用此查询语句

创建包含一些外键的表(订单)
CREATE TABLE orders

)
order_id    VARCHAR2(20),
item_id     VARCHAR2(30) CONSTRAINT item_id_not_null NOT NULL,
quantity_id VARCHAR2(30) CONSTRAINT quantity_id_not_null NOT NULL,
customer_id VARCHAR2(30) CONSTRAINT mobile_no_not_null NOT NULL,
CONSTRAINT order_pk PRIMARY KEY(order_id),
CONSTRAINT fk_customer FOREIGN KEY (customer_Id) REFERENCES ORDER(customer_Id),
CONSTRAINT fk_item FOREIGN KEY (item_Id) REFERENCES ORDER(item_Id),
 CONSTRAINT fk_quantity FOREIGN KEY (quantity_Id) REFERENCES ORDER(quantity_Id)
 );

我得到以下回复,

  

SQL错误:ORA-00903:表名无效   00903. 00000 - “表名无效”

1 个答案:

答案 0 :(得分:2)

FK定义中存在拼写错误。该表应为ORDERS而不是ORDER,这是一个保留关键字。