I would like to have a native query for Postgresql, however I could not make it work with dates. I can receive date as null, or date as date, so I like to work in both cases:
" case when coalesce (?3, null) = ?3 then true " +
" else p.start_date = ?3 end"
if ?3 is the third parameter and can be null and it is of type LocalDate
I tried many variations, but could not make it work for both cases, separately it will work:
- if
coalesce (?3, null) = ?3
for date param null it will work - if
p.start_date = ?3
for date param != null it will work
The column in the database is date
Thanks:)
This worked for me :
So, I am passing string parameter and convert it to date, because nothing else worked for me