Oracle8i 第一日曜日を取得

alter session set nls_date_format = ‘yyyy/mm/dd’;
alter session set NLS_DATE_LANGUAGE=’japanese’;
select NEXT_DAY(round(DATE ’2010-1-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-2-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-3-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-4-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-5-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-6-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-7-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-8-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-9-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-10-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-11-01′-1,’dd’),’日曜’) first_sun from dual;
select NEXT_DAY(round(DATE ’2010-12-01′-1,’dd’),’日曜’) first_sun from dual;

▼ 上記の実行結果

FIRST_SUN
———-
2010/01/03
2010/02/07
2010/03/07
2010/04/04
2010/05/02
2010/06/06
2010/07/04
2010/08/01
2010/09/05
2010/10/03
2010/11/07
2010/12/05

コメントを残す

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>