Skip to content
Advertisement

Conditional where clause in Oracle SQL query is not working

I am trying to do a select on Oracle DB with this condition but it is not working.

Table POST

but when endDate is null I got the error

Please help

Advertisement

Answer

The solution was to transform the Date in String, and in the select do this and (:endDate is null or pl.date_end <= TO_DATE(:endDate , ‘yyyy-MM-dd HH:MI:SS’))

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement