Below is my query, here i am not having any record which satisfies LOCATION ='123' in LOCATION_TB table then also my join query is executing and is giving -811 error due to more than 1 row returning when only one is expected, why it is executing like that.
when no row satisfies then it should not eecute Inner query right?
It should return ' ', please let me know how it is working ?
When SUBSTR(L.LOCATION,1,3) = '123' Then
(Select SUBSTR(LOC_CD,1,3) from POST Where POST_CD = L.POST_TX)
Else ' '
End ) ),( ' ' )) as ADDRESS_CODE from LOCATION_TB L