Tuesday, March 30, 2010

Query to calculate week number from a given date

SELECT CEIL ( ( 7
+ ( TRUNC (TO_DATE (p_booking_date), 'd')
- TRUNC (TO_DATE (p_booking_date), 'Y')
)
)
/ 7
)
INTO l_qtr
FROM DUAL;

No comments: