Parameter value [100] did not match expected type [java.time.LocalDateTime (n/a)]

5.1k Views Asked by At

I am facing weird problem in one query

select * from sbill.act_sub_t where (act_sub_t.unsub_dt - 
act_sub_t.sub_dt) < 100;

Using this query i am getting result in oracle sql developer tool but facing below issue with java.

 Parameter value [100] did not match expected type 
 [java.time.LocalDateTime (n/a)]

Below is the java code

  Query query1 = entityManager.createQuery("select * from ActSubT 
  where (ActSubT.unsub_dt - ActSubT.sub_dt) <:days").setParameter("days", 
   100);
1

There are 1 best solutions below

7
Arulkumar On BEST ANSWER

Can you try with TO_DATE()

select * from sbill.act_sub_t 
where (TO_DATE(act_sub_t.unsub_dt, 'YYYY-MM-DD') - TO_DATE(act_sub_t.sub_dt, 'YYYY-MM-DD')) < 100;