trunc 函数用法
转载至:http://blog.csdn.net/aqszhuaihuai/article/details/6303686
1.trunc用于日期,可精确到年,月和日.
select trunc(sysdate,'yyyy') from dual;

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

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

第一个参数为日期,第二个参数为格式(format),即trunc(date,format);
如果省略format表示精确到日。
2.trunc也可用于数值,截断位数
SQL> select trunc(123.3210,2 ) from dual;
TRUNC(123.3210,2)
-----------------
123.32
SQL> select trunc(123.3210) from dual;
TRUNC(123.3210)
---------------
123
SQL> select trunc(123.3210,-2) from dual;
TRUNC(123.3210,-2)
------------------
100
第一个参数为数值,第二个参数为精度(decimals)表示保留几位小数点,即trunc(number,decimals)
如果decimals为负数,表示小数点左边指定位数后面的部分以0替换。
如果省略decimals表示截去小数部分
trunc 函数用法的更多相关文章
- oracle trunc函数用法
转自:https://www.e-learn.cn/content/qita/699481 /**************日期********************/ select trunc(sy ...
- OAF中trunc函数的使用(转)
原文地址:OAF中trunc函数的使用 需求:在做OAF开发时,经常会需要查询功能,由于需求的不同,往往不能使用OAF标准的查询功能,需要自己客户化实现查询功能,而在查询功能中,经常会遇到查询的时间范 ...
- Oracle trunc()函数的用法
Oracle trunc()函数的用法 /**************日期********************/1.select trunc(sysdate) from dual --2013-0 ...
- oracle获取本月第一天和最后一天及Oracle trunc()函数的用法
select to_char(trunc(add_months(last_day(sysdate), -1) + 1), 'yyyy-mm-dd') "本月第一天", to_cha ...
- Oracle trunc()函数的用法--来着心静禅定ing
1.TRUNC(for dates) TRUNC函数为指定元素而截去的日期值. 其具体的语法格式如下: TRUNC(date[,fmt]) 其中: date 一个日期值 fmt 日期格式,该日期将由指 ...
- Oracle trunc()函数的用法及四舍五入 round函数
--Oracle trunc()函数的用法/**************日期********************/1.select trunc(sysdate) from dual --2011 ...
- [转]Oracle trunc()函数的用法
原文地址:http://www.cnblogs.com/gengaixue/archive/2012/11/21/2781037.html 1.TRUNC(for dates) TRUNC函数为指定元 ...
- Oracle trunc()函数,decode()函数,substr函数,GREATEST函数,java中substring函数的用法
--Oracle trunc()函数的用法/**************日期********************/1.select trunc(sysdate) from dual --2013- ...
- TRUNC函数的用法
TRUNC函数用于对值进行截断. 用法有两种:TRUNC(NUMBER)表示截断数字,TRUNC(date)表示截断日期. (1)截断数字: 格式:TRUNC(n1,n2),n1表示被截断的数字,n2 ...
随机推荐
- 23.Merge k Sorted Lists (Array, Queue; Sort)
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思 ...
- C# 将Word,Execl,PPT,Project, 文件转成PDF, 不依赖Office!!
git 地址 https://gitee.com/bandung/Execl_WordTOPDF.git 包括了各种破解的dll Word转PDF 挨个引用 Word转PDF public void ...
- Unity5-CacheServer(资源平台切换之缓存服务器)的部署与使用
不管你是个人还是团队,如果你的资源很多, 而且经常切换平台, 那你试试这个吧~~兼职爽爆了,秒秒钟实现平台间的转换. cache server主要用于资源修改后的自动重新导入功能,保证所见即所得,方便 ...
- Qt Pro file
Qt keys qmake Manual Building Common Project Types #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
- golang之指针
先上代码 package main import "fmt" type myInt int //匿名函数 //值的接收 //指针的接收 //*myint表示myInt的指针类型 / ...
- YUI前端优化之javascript,css篇
三.JavaScript和CSS篇 JavaScript和CSS也是我们页面中经常用到的内容,对它们的优化也提高网站性能的重要方面:CSS:把样式表置于顶部避免使用CSS表达式(Expression) ...
- Centos 7 手把手教你使用YUM方式安装并配置Nginx+php7-fpm+MySQL
需要准备的内容 一台纯净系统的服务器 远程连接服务器的工具 (我这里使用Xshell) 安装nginx 链接上服务器后执行 yum install nginx 这里需要输入y 后回车,开始安装ngi ...
- view添加虚线边框
CAShapeLayer *border = [CAShapeLayer layer]; border.strokeColor = SLColorLine.CGCo ...
- SCI EI期刊
coming soon 关键字:Computer Vision, Computing, Image, Intelligence, IEEE, Compution <Journal of Expe ...
- [解决]--java_out: User.proto: User.proto: Cannot generate Java output because the file 's
在使用 protocol buffer 的时候,用.proto文件生成代码文件时报错 使用命令 protoc.exe --java_out c:\logs\ User.proto User.proto ...