Po převodu varchar2 datum na skutečné date datový typ, poté převeďte zpět na varchar2 s požadovanou maskou:
to_char(to_date('01/02/2012','MM/DD/YYYY'),'WW')
Pokud chcete číslo týdne v number datový typ, můžete příkaz zabalit do to_number() :
to_number(to_char(to_date('01/02/2012','MM/DD/YYYY'),'WW'))
Je však třeba zvážit několik možností čísel týdne:
WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
IW Week of year (1-52 or 1-53) based on the ISO standard.