使用pl/sql的月份的最后一个日期 [英] Last dateof month using pl/sql

查看:123
本文介绍了使用pl/sql的月份的最后一个日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PL/SQL编写程序

I want to write a programm using PL/SQL

如果一个人的出生日期是1978年5月12日,那么该人的退休日期应该是2038年5月12日,但是该人的退休日期应该是该月的最后一个日期,而不是2038年5月12日. (它将自动重定向同一个月的最后一天).

If the date of birth of one person is 12th May 1978, so that the person retirement date should be 12th may 2038, but instead of 12th may 2038 the date of retirement of that person will be the last date of the same month (it will automatically redirect the last day of the same month).

推荐答案

Oracle具有

Oracle has a last_day function that does exactly that:

select sysdate, last_day(sysdate) from dual;

SYSDATE   LAST_DAY(SYSDATE)
--------- -----------------
19-DEC-13 31-DEC-13         

从PL/SQL:

declare
  month_end date;
begin
  month_end := last_day(sysdate);
end;

...但是输入您调整后的出生日期值.

... but pass in your adjusted date of birth value.

这篇关于使用pl/sql的月份的最后一个日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆