select trunc(to_number(to_char(sysdate,'DDD'))/7)+1 from dual;
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Guys,
Does anyone consider reading the documentation before asking?
The SQL Refference says
Date format models
IW Week of year (1-52 or 1-53) based on the ISO standard.
so
select to_number(to_char(sysdate,'IW')) from dual;
Is supposed to return the number of the CALENDAR week of the current date.
In the first case, when fiscal year starts at 1st of january, that seems to be the same
In the second case I would go for
select to_number(to_char(sysdate,'IW')) - to_number(to_char(to_date(1st of april),'IW')) from dual;
So really, the Oracle documentation is great thing
I would recommend
SQL Reference
Database Administration guide
Concepts guide
Bookmarks