I used decoding and case register to solve this problem. This was done in oracle.
AND DECODE(TSBI.SHIP_TRAIL_STATUS, 'L', 'TRUE', 'C', (SELECT CASE WHEN TSBI.UPD_ON + 10 >= SYSDATE THEN 'TRUE' ELSE 'FALSE' END FROM DUAL)) = 'TRUE'
In this state, I checked SHIP_TRAIL_STATUS. In case it returns 'L', the decoding function returns TRUE. In case it returns "C", decoding checks the value of UPD_ON. Accordingly, this CASE statement returns TRUE or FALSE.
source share