首页 > 数据库技术 > 详细

Oracle trunc()函数的用法

时间:2020-09-16 21:11:40      阅读:50      评论:0      收藏:0      [点我收藏+]

select trunc(20171106/100,0) from tabledate --------------结果为201711
select trunc(20171106/10000,0)*100 from tabledate -----结果为201700
两个值相减就是月份了,两表对比查询时,20171106 可以用字段替换,
如:

select *
from tablename a, tabledate b
where a.month =
trunc(b.beg_date / 100, 0) - runc(b.beg_date / 10000, 0) * 100

Oracle trunc()函数的用法

原文:https://www.cnblogs.com/docstrange/p/13680889.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!