错误ORA-00923

时间:2017-05-21 09:11:48

标签: sql oracle ora-00923

我收到以下错误" ORA-00923:找不到FROM关键字"在执行查询时,注意:已经使用此查询与不同的表及其工作,所以,我需要你的帮助:)

LOAD * ,
date(POST_DATE,'MM/DD/YYYY') as VOU_POST_DATE,
date(CREATED_DATE,'MM/DD/YYYY') as VOU_CREATED_DATE,
year (POST_DATE) as VOU_POST_YEAR ,
month (POST_DATE) as VOU_POST_MONTH,
day (POST_DATE) as VOU_POST_DAY, 
year (CREATED_DATE) as VOU_CREATED_YEAR ,
month (CREATED_DATE) as VOU_CREATED_MONTH,
day (CREATED_DATE) as VOU_CREATED_DAY;

Select 
t.QTY as VOU_QTY,
t.COST as VOU_COST,
t.PRICE as VOU_PRICE,
t.QTY*t.COST as VOU_EXT_COST,
t.QTY*t.PRICE as VOU_EXT_PRICE,
t.ITEM_SID,
o.STORE_NO as VOU_STORE_NO,
o.VOU_NO,
o.VOU_TYPE, 
o.VOU_CLASS,
o.VEND_CODE as VOU_VEND_CODE,
o.SLIP_FLAG,
o.TO_NO,
o.REF_VOU_SID,
o.CREATED_DATE,
o.POST_DATE,
o.SLIP_FLAG as SLIP_FLAGS,
o.VERIFIED,
st.QTY as TRANS_OUT_QTY
s.OUT_STORE_NO as SLIP_OUT_STORE,
s.IN_STORE_NO as SLIP_IN_STORE,


CASE
when o.VEND_CODE is not NULL
and o.TO_NO is NULL 
then t.QTY
else 0
end CMP_RCVD_QTY,


CASE
when o.VEND_CODE is NULL 
and o.TO_NO is not NULL 
then t.QTY
else 0
end FST_RCVD_QTY,


CASE
when o.VEND_CODE is NULL 
and o.TO_NO is NULL 
then t.QTY
else 0
end TRANS_IN_QTY,

CASE
when o.VOU_CLASS=2 
then t.QTY
else 0
end ASN_QTY,

from VOUCHER o
join VOU_ITEM t
on o.VOU_SID = t.VOU_SID 

Join SLIP s
on s.VOU_SID = o.VOU_SID 

join  SLIP_ITEM st
on st.ITEM_SID = t.ITEM_SID
where 
o.HELD=0 and o.REF_VOU_SID is NULL;

1 个答案:

答案 0 :(得分:0)

,

之后添加TRANS_OUT_QTY
o.VERIFIED,
st.QTY as TRANS_OUT_QTY
s.OUT_STORE_NO as SLIP_OUT_STORE,

并在from子句之前删除,

CASE
when o.VOU_CLASS=2 
then t.QTY
else 0
end ASN_QTY,

from VOUCHER o
join VOU_ITEM t
on o.VOU_SID = t.VOU_SID

Oracle期望FROM关键字,我们以逗号分隔的列列表结束。正如您所看到的,您忘记在,st.QTY as TRANS_OUT_QTY之后输入FROM字段,因此错误ORA-00923: FROM keyword not found where expected

修复第一个语法错误后,您会遇到另一个名为ORA-00936: missing expression的错误,因为您在,之后提供了额外的end ASN_QTY,,表示{{1}后面有更多的表达式但是没有。