分类(Oracle)
TRUNC用法_总结中
2009/05/13 17:05

 trunc(DATE '2009-04-13') 返回日期2009-04-13

----------------------------------------------------------------------------------------------------------------------

语法:TRUNC(date[,fmt])
D,WQ @1j!ES1} M| j0   TRUNC(number[,decimals])

Select trunc(TO_DATE('24-11-1999 08:00 pm','dd-mm-yyyy hh:mi am')) RESULT From dual

= 11/24/1999
,jw2@#tX8~,b0select trunc(sysdate,'day') result from dual

=本周第一天
`"n5S X*y_u5p5a0select trunc(sysdate,'yy') result from dual

=本年第一天
nTnG:h V z Dy0select trunc(sysdate,'yy')-1 result from dual

=上年最后一天

select trunc(sysdate,'mm') result from dual

=本月第一天

select trunc(sysdate,'dd') result from dual

当天

Select trunc(2999.99222,-3) From dual = 2000

Select trunc(2999.99222,1) From dual =2999.9

Select trunc(2999.99222,2) From dual = 2999.99

 

Tags: Oracle
相关日志:
+引用(0) |
发表评论
昵称  密码  游客无需密码
网址  电邮  注册
验证码 请输入左侧图片中的字符
记住我