Is there a default function in Oracle that allows you to pass the date as the parameter, and it returns whether it is a US holiday or not?
something like
IS_HOLIDAY(:DATEINPUT)
I need to do this without a stored procedure. In my select statement, what I’d like to do is filter out data based on holday, in my where clause.
Please help.
No. There is no built-in function. Even if you cut it down to just US holidays, that’s still not deterministic. Different states have different holidays, different companies recognize different holidays, and different companies deal with holidays differently (i.e. holidays that fall on a Saturday may get celebrated on the prior Friday, the subsequent Monday, or not at all). Realistically, that means that your organization almost certainly wants a custom table of the holidays that your organization recognizes and when those holidays are celebrated.
Why can’t you use a stored procedure for this? You could, of course, simply list out the valid holidays in your SQL query but that would be rather inelegant– a table of holidays and a stored function that determines whether a date falls on a holiday would seem much more practical.