如何使用 PLSQL 仅更改年份而不更改日期或月份来更新日期列?
我有一个包含信用卡记录的数据库表。其中一个字段是“日期”字段。如果年份小于 2010 年,我想通过将日期的年份部分更改为 2011 来更新此字段。据我所知,PLSQL 具有时间和月份的函数,但与年份无关(据我所知)。
I have a database table containing credit card records. One of the fields is a Date field. I would like to update this field by changing the year portion of the date to 2011 if the year is less than 2010. From what i have found, PLSQL has functions for time and months but nothing to do with years (to my knowledge).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这展示了如何
This shows how to
1 年 = 12 个月,因此减去 12 个月:
1 year = 12 months, so subtract 12 months:
以下是如何使用 add_months 来实现闰年。
Here's how to do it so it works with leap years using add_months.