需要从数据库中获取当前日期(不包括时间)的记录

Need to get records from db for current date(excluding time)

我写了下面的查询来获取记录:

Select * 
  from Scf_Invoice i 
 where cast(i.inv_Acceptance_Date as date) = TO_DATE('2018-12-18', 'YYYY-MM-DD');

但是,即使给定日期有 2 条记录,我也得不到任何结果。我认为它也在考虑时间。当我做

Select * 
  from Scf_Invoice i 
 where cast(i.inv_Acceptance_Date as date) > TO_DATE('2018-12-18', 'YYYY-MM-DD');

我得到了结果,但我希望使用“=”参数获得这些结果。我应该对查询进行哪些更改?

使用trunc得到天数

  trunc(i.inv_Acceptance_Date) =

The TRUNC (date) function returns date with the time portion of the day truncated to the unit specified by the format model fmt. The value returned is always of datatype DATE, even if you specify a different datetime datatype for date. If you omit fmt, then date is truncated to the nearest day.

Select * 
from Scf_Invoice i 
where trunc(i.inv_Acceptance_Date) = TO_DATE('2018-12-18', 'YYYY-MM-DD');
Select * 
  from Scf_Invoice i 
 where trunc(i.inv_Acceptance_Date) = TO_DATE('2018-12-18', 'YYYY-MM-DD');

Select * 
  from Scf_Invoice i 
 where trunc(i.inv_Acceptance_Date) = trunc(sysdate);

获取等于当前日期的数据