I think Tom Kyte was the originator of this technique. It's not necessarily the fastest method, but it's super convenient - no table required.
Today I wanted to know how many weekdays a year, so I defined 365 rows on the fly using sysdate to turn these into each day of the year. Then I ran a simple select over this to aggregate my result
with years as ( select to_char(trunc(sysdate,'yy')+rownum-1,'dy') dy from dual connect by level <= 365 ) select count(*) ,sum(case when dy in ('sat','sun') then 1 end) weekends from yearsYou can see this demonstrated at livesql.oracle.com
Never heard of it? I recommend you have a play. I've only dabbled myself, but if you don't have an environment to experiment with, this is free!