You could use a query like this one here:
and table.BEGIN_DATE <= pREFERENCE_END_DATE and (table.END_DATE >= pREFERENCE_BEGIN_DATE or table.END_DATE is null)
Best Regards