I wrote the below JPQL.
select e.name from emp e where e.date = nvl(:date,select max(date) from emp e where e.id=1);
When I pass the date value, it should run the JPQL with the given date value. If I don't pass any date value then the JPQL should run with max(date)
.
But getting an exception inconsistent datatypes
.
Observations :
If I change the query to :
select e.name from emp e where e.date = :date
It is working fine. But when I use nvl
I'm getting the exception.