I have created a native query with interval. The query works fine when i hard code day
in query:
@Query(value="select * from orders where created_date < clock_timestamp() - interval ' 5 days'",nativeQuery=true)
But when i provide data with @Param
like this:
@Query(value="select * from orders where created_date < clock_timestamp() - interval :day 'days'",nativeQuery=true)
List<Order> getData(@Param("day") String day)
I got this error:
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"