日期:2014-05-16  浏览次数:20351 次

当前日期的周日日期如何取得
update DIM_TIME f
   set f.firstday_of_week = case
                              when f.full_date < round(f.full_date, 'day') then
                               to_char(round(f.full_date, 'day') - 7,
                                       'yyyy-mm-dd')
                              else
                               to_char(round(f.full_date, 'day'),
                                       'yyyy-mm-dd')
                            end
   where f.year<2012


检查一下更新的是否正确

select f.firstday_of_week,
       case
         when f.full_date < round(f.full_date, 'day') then
          to_char(round(f.full_date, 'day') - 7, 'yyyy-mm-dd')
         else
          to_char(round(f.full_date, 'day'), 'yyyy-mm-dd')
       end
  from dim_time f where f.year<2012;