ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 距离下个结婚纪念日还有多少天

距离下个结婚纪念日还有多少天

原创 Linux操作系统 作者:love2008 时间:2009-07-10 09:42:01 0 删除 编辑

今天比较闲,就写了一个SQL来实现距离下个结婚纪念日还有多少天。跟老婆经历了风风雨雨,我们终于走到了一起,希望你能够幸福、健康。我们会永远快乐的生活,不会在让你受到任何伤害。老婆,我爱你。

select ceil(to_date((case when to_number(to_char(sysdate,'mm'))<2 then to_char(sysdate,'yyyy')
                          when to_number(to_char(sysdate,'mm'))=2 and to_number(to_char(sysdate,'dd'))<=26 then to_char(sysdate,'yyyy')
                     else to_char(to_number(to_char(sysdate,'yyyy')) + 1) end)||'0206','yyyymmdd') - sysdate)
from dual;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/728254/viewspace-608801/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-10

  • 博文量
    78
  • 访问量
    1128394