曜日(day_of_week)と週の始まりの日付(weekBegin)を特定できる単純な問合わせの例を以下に示します。セッション カレンダは、ISOとCOMPATIBLEのシステム定義カレンダです。
- 最初の2つの例は、特定の日付の曜日(曜日1、2、7など)を返すために使用できるクエリーです。
- 最後の2つの例は、特定の日付が属す週の初日(曜日1)の日付を返すために使用できるクエリーです。
例: 曜日(ISOカレンダ)
Sel day_of_week from Sys_Calendar.Calendar where calendar_date = date '2011-01-01'; day_of_week ----------- 6
例: 曜日(COMPATIBLEカレンダ)
Sel day_of_week from Sys_Calendar.Calendar where calendar_date = date '2011-01-01'; day_of_week ----------- 1
例: 週の始まり(ISOカレンダ)
Sel weekBegin from Sys_Calendar.BusinessCalendar where calendar_date = date '2011-01-01'; WeekBegin ----------- 10/12/27
例: 週の始まり(COMPATIBLEカレンダ)
Sel weekBegin from Sys_Calendar.BusinessCalendar where calendar_date = date '2011-01-01'; WeekBegin ----------- 11/01/01