这取决于你所追求的.如果你在接下来的7天之后,那么:
select *
from my_table
where date_col between :my_date and :my_date + 7
如果你想说周一到周日,那么使用next_day功能:
select *
from my_table
where date_col between next_day(:my_date, 'Monday') - 7
and next_day(:my_date, 'Monday')
两个地方:my_date是你传入的日期.
如果您没有传递日期而是传递字符串,那么第一个将使用to_date函数:
select *
from my_table
where date_col between to_date(:my_date,'dd/mm/yyy') + 7
and to_date(:my_date,'dd/mm/yyy')
你可以为第二个做类似的事情.如果你必须使用to_date,那么date_col应该在to_date(date_col,’dd / mm / yyyy’)上有一个function-based index,或者如果你要以不同的方式转换它.