Using HQL to query on a date while ignoring the time on Oracle

后端 未结 4 1092
暖寄归人
暖寄归人 2020-12-06 04:59

I have a table (in Oracle 9 and up) where I need to find all entries for a given day using Hibernate. The entries have timestamps (with data type \'date\'). Some of the entr

4条回答
  •  时光说笑
    2020-12-06 05:49

    you can use the trunc() function to remove the time part in the DATE column.

    eg : select * from emp where trunc(emp_date) < trunc(current_date()-30)

    fetches all the employee details who were employed 1 month before

提交回复
热议问题