我正在尝试通过在分配的表空间 tbspUser1 上连接 4 个表来创建单个表。
我使用了以下语句:
CREATE TABLE SingleTable AS(
SELECT customer.c_id AS Customer_ID,
customer.c_uname AS CUSTOMER_UName,
ORDERS.o_id AS Order_ID,
ORDER_LINE.ol_i_id As Order_Item_ID,
ITEM.I_TITLE AS Item_Title
FROM customer INNER JOIN orders ON customer.C_ID=orders.O_C_ID
INNER JOIN order_line ON orders.o_id=order_line.ol_o_id
INNER JOIN item ON order_line.ol_i_id=item.i_id) TABLESPACE tbspUser1;
我得到了错误:
Error starting at line 1 in command:
CREATE TABLE SingleTable AS(
SELECT customer.c_id AS Customer_ID,
customer.c_uname AS CUSTOMER_UName,
ORDERS.o_id AS Order_ID,
ORDER_LINE.ol_i_id As Order_Item_ID,
ITEM.I_TITLE AS Item_Title
FROM customer INNER JOIN orders ON customer.C_ID=orders.O_C_ID
INNER JOIN order_line ON orders.o_id=order_line.ol_o_id
INNER JOIN item ON order_line.ol_i_id=item.i_id) TABLESPACE tbspUser1
Error at Command Line:9 Column:50
Error report:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
我一直在调试和检查我的代码有什么问题,并自行运行了我的 select 语句:
SELECT customer.c_id AS Customer_ID,
customer.c_uname AS CUSTOMER_UName,
ORDERS.o_id AS Order_ID,
ORDER_LINE.ol_i_id As Order_Item_ID,
ITEM.I_TITLE AS Item_Title
FROM customer INNER JOIN orders ON customer.C_ID=orders.O_C_ID
INNER JOIN order_line ON orders.o_id=order_line.ol_o_id
INNER JOIN item ON order_line.ol_i_id=item.i_id;
它返回了以下字段的记录,没有错误:
CUSTOMER_ID CUSTOMER_UNAME ORDER_ID ORDER_ITEM_ID ITEM_TITLE
----------- -------------------- ---------- ------------- ------------------------------------------------------------
如果有人可以通过在分配的表空间语句上连接 4 个表来指导我创建单个表有什么问题,我将不胜感激。
谢谢!