我有一个SELECT
语句,它工作正常,直到CASE
部分,我认为这只是一个语法错误和lead time
位。我正在使用Oracle APEX。计算列中的CASE语句问题
我得到错误;
ORA-00923: FROM keyword not found where expected
select
supplier.companyname as "Supplier",
purchaseorder.orderdate as "Order Date",
purchaseorder.duedate as "Due Date",
popayment.datedelivered as "Delivered",
(popayment.paymentdate - popayment.datedelivered) - 31 as paidontime,
/* this is the same as the next one (this works fine) */
(popayment.datedelivered - purchaseorder.duedate) - 1 as deleiverylate,
/* trying to advance the previous query (this does not work) */
popayment.datedelivered - purchaseorder.duedate -1,
case when "lead time" <0 then 'early'
when "lead time" >0 then 'late'
else 'on time'
end as "lead time";
from supplier, purchaseorder, suppliercontact, popayment
where
purchaseorder.SUPPLIERCONTACTID2 = suppliercontact.suppliercontactid
and
supplier.supplierid = suppliercontact.supplierid
and
purchaseorder.purchaseorderid = popayment.purchaseorderid
order by COMPANYNAME
感谢所有帮助 危险布赖恩
为什么在“提前期”之后有分号?那不应该在那里。 (并且与错误无关,但为什么不使用ANSI风格的联接呢?) –
@DangerousTreacle能否在'lead time'<0'的情况下解释字段'lead time'? –