ORA-00933命令未正确结束错误

时间:2018-12-17 09:21:17

标签: sql oracle

(select DETAIL_ID 
   from OD_TO_SOURCE 
  where OD_SOURCE_ID='S1Mh8trcQL6ggWbt001001') OD_TO_SRC 
  inner join obligation_detail 
     on OD_TO_SRC.OBLIGATION_DETAIL_ID=obligation_detail.detail_id 
  where obligation_detail.record_status = '0' 
    and obligation_detail.obligation_detail_status = '2' 
    and obligation_detail.settlement_date = '20181217'

以上sql显示

  

ORA-00933命令未正确结束

错误。谁能让我知道是什么问题?

2 个答案:

答案 0 :(得分:1)

我怀疑这是您要在这里执行的操作

select
    ots.DETAIL_ID
from OD_TO_SOURCE ots
inner join obligation_detail od
    on ots.OBLIGATION_DETAIL_ID = od.detail_id
where
    ots.OD_SOURCE_ID = 'S1Mh8trcQL6ggWbt001001' and
    od.record_status = '0' and
    od.obligation_detail_status = '2' and 
    od.settlement_date = '20181217'

您似乎正在尝试将OD_TO_SOURCE表上的子查询加入查询的其余部分。但是,我认为不需要子查询。

答案 1 :(得分:1)

希望对您有帮助,此查询不完整,select语句在哪里?

select OD_TO_SRC .* from 
(select DETAIL_ID 
   from OD_TO_SOURCE 
  where OD_SOURCE_ID='S1Mh8trcQL6ggWbt001001') OD_TO_SRC 
  inner join obligation_detail 
     on OD_TO_SRC.OBLIGATION_DETAIL_ID=obligation_detail.detail_id 
  where obligation_detail.record_status = '0' 
    and obligation_detail.obligation_detail_status = '2' 
    and obligation_detail.settlement_date = '20181217