YatShan
YatShan

Reputation: 444

How to fix ORA-00933 command not properly ended error

(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'

Above sql displays

ORA-00933 command not properly ended

error. Can anyone let me know what is the issue? Thank you

Upvotes: 0

Views: 52

Answers (2)

Kedar Limaye
Kedar Limaye

Reputation: 1041

Hope this helps you,this query is incomplete where is select statement?

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

Upvotes: 1

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522712

I suspect this is what you want to do here:

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'

It appears that you were trying to join a subquery on the OD_TO_SOURCE table to the rest of your query. But, I see no need for a subquery.

Upvotes: 1

Related Questions