[英]I keep getting "table or view does not exist " in oracle- live
我正在处理 Oracle live(在线版本),我创建了事实表,但是我一直收到这个错误。 “ORA-00942:表或视图不存在”我也分解了查询,但我仍然得到错误。
create table fact_table(
customer_id number not null,
order_id number not null,
product_id number not null,
employee_id number not null,
unit_price number not null,
quantity number not null,
order_total number not null,
salary number not null,
commission_pct number,
CONSTRAINT FK_Customers_dim
FOREIGN KEY (customer_id) REFERENCES Customers_dim(customer_id),
CONSTRAINT FK_Order_dim
FOREIGN KEY (order_id) REFERENCES Order_dim(order_id),
CONSTRAINT FK_Employees_dim
FOREIGN KEY (employee_id) REFERENCES Employees_dim(employee_id),
CONSTRAINT FK_product_dim
FOREIGN KEY (product_id) REFERENCES product_dim(product_id),
constraints pk_fact_table
primary key (customer_id , order_id, product_id ,employee_id)
);
我得到了同样的结果,在我的数据库中运行它:
SQL> create table fact_table(
2 customer_id number not null,
3 order_id number not null,
4 product_id number not null,
5 employee_id number not null,
6 unit_price number not null,
7 quantity number not null,
8 order_total number not null,
9 salary number not null,
10 commission_pct number,
11 CONSTRAINT FK_Customers_dim
12 FOREIGN KEY (customer_id) REFERENCES Customers_dim(customer_id),
13 CONSTRAINT FK_Order_dim
14 FOREIGN KEY (order_id) REFERENCES Order_dim(order_id),
15 CONSTRAINT FK_Employees_dim
16 FOREIGN KEY (employee_id) REFERENCES Employees_dim(employee_id),
17 CONSTRAINT FK_product_dim
18 FOREIGN KEY (product_id) REFERENCES product_dim(product_id),
19 constraints pk_fact_table
20 primary key (customer_id , order_id, product_id ,employee_id));
FOREIGN KEY (customer_id) REFERENCES Customers_dim(customer_id),
*
ERROR at line 12:
ORA-00942: table or view does not exist
SQL>
那么,这意味着什么? 这意味着您引用的表应该在此之前创建; 否则,您将无法创建外键约束。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.