ORA 00936 缺少表达式
Posted
技术标签:
【中文标题】ORA 00936 缺少表达式【英文标题】:ORA 00936 Missing Expression 【发布时间】:2014-10-05 16:32:27 【问题描述】:我浏览了该网站,但无法找到我的问题的答案,许多问题很接近,但都不相同。我正在尝试从两个表中选择数据并加入五个。我没有为其选择信息的三个是publisher、order_items 和book_order。它们只是 ERD 中的表格。我不断收到 ORA 00936:我的 FROM 行中缺少表达式。但我不知道是什么原因造成的。所有表都准确表示,唯一不同的是 SELECT 行中的 TO_CHAR 语句。我认为这可能是问题所在。
SELECT book_customer.firstname, book_customer.lastname,
TO_CHAR(book_order.orderdate,'MM/DD/YYYY') AS "Order Date",
FROM book_customer, book_order, order_items, books, publisher
WHERE (book_customer.customerid = book_order.customerid)
AND (book_order.orderid = order_items.orderid)
AND (order_items.bookid = books.bookid)
AND (books.pubid = publisher.pubid)
AND (publisher.publishername = 'printing with us');
【问题讨论】:
FROM前有逗号。 你应该学会使用正确的显式join
语法,尽管这与这个特定问题无关。
【参考方案1】:
from
子句前有一个多余的逗号 (,
):
SELECT book_customer.firstname, book_customer.lastname,
TO_CHAR(book_order.orderdate,'MM/DD/YYYY') AS "Order Date" -- Comma removed here
FROM book_customer, book_order, order_items, books, publisher
WHERE (book_customer.customerid = book_order.customerid)
AND (book_order.orderid = order_items.orderid)
AND (order_items.bookid = books.bookid)
AND (books.pubid = publisher.pubid)
AND (publisher.publishername = 'printing with us');
【讨论】:
以上是关于ORA 00936 缺少表达式的主要内容,如果未能解决你的问题,请参考以下文章