TRUNC(number,num_digits)
Number 需要截尾取整的数字。
Num_digits 用于指定取整精度的数字。Num_digits 的默认值为 0。
 
/**************日期********************/
1.select trunc(sysdate) from dual --2011-3-18 今天的日期为2011-3-18
2.select trunc(sysdate, 'mm') from dual --2011-3-1 返回当月第一天.
3.select trunc(sysdate,'yy') from dual --2011-1-1 返回当年第一天
4.select trunc(sysdate,'dd') from dual --2011-3-18 返回当前年月日
5.select trunc(sysdate,'yyyy') from dual --2011-1-1 返回当年第一天
6.select trunc(sysdate,'d') from dual --2011-3-13 (星期天)返回当前星期的第一天
7.select trunc(sysdate, 'hh') from dual --2011-3-18 14:00:00 当前时间为14:41
8.select trunc(sysdate, 'mi') from dual --2011-3-18 14:41:00 当前分钟
TRUNC()函数没有秒的精确
/***************数字********************/
/*
TRUNC(number,num_digits)
Number 需要截尾取整的数字。
Num_digits 用于指定取整精度的数字。Num_digits 的默认值为 0。
TRUNC()函数截取时不进行四舍五入
*/
9.select trunc(123.458) from dual --123
10.select trunc(123.458,0) from dual --123
11.select trunc(123.458,1) from dual --123.4
12.select trunc(123.458,-1) from dual --120
13.select trunc(123.458,-4) from dual --0
14.select trunc(123.458,4) from dual --123.458
15.select trunc(123) from dual --123
16.select trunc(123,1) from dual --123
17.select trunc(123,-1) from dual --120

查询某天的数据?
select * from table_name where trunc(日期字段)=to_date('2003-05-02','yyyy-mm-dd');

最新文章

  1. 关于Oracle表连接
  2. Oracle启动报错ORA-03113解决
  3. 【JAVA并发编程实战】3、同步容器
  4. lucene中Field.Index,Field.Store详解
  5. HDU 2669
  6. 转 nutch网页快照乱码解决方法
  7. 移动端rem页面详谈
  8. oracle 数据库时间类型为字符串 时间范围大小查询
  9. OSVERSIONINFO
  10. 【转】如何使用PhoneGap打包Web App
  11. PL/SQL 下邮件发送程序
  12. iOS - 打电话, 发短信
  13. MIPI D-PHY 简写收集
  14. (转载)js获取JqueryString方法小结
  15. [C#][ASP.net] 透过WebBrowser 取得AJAX 后的网页
  16. 警惕!MySQL成数据勒索新目标
  17. [LeetCode] Second Minimum Node In a Binary Tree 二叉树中第二小的结点
  18. plsql developer 使用 oracle instantclient的安装和配置
  19. 统计信息不准导致sql性能下降
  20. 五道java小题,补更四道java小题

热门文章

  1. golang项目结构
  2. 【Spring】Spring之浅析Spring框架的搭建
  3. 【转载】Chrome插件开发 尝试
  4. vc2010 属性值无效 灾难性故障 解决方法
  5. 【转】UML类图符号 6种关系说明以及举例
  6. 【转载并整理】Linux - centOS 6 SVN服务器安装、配置及开机启动
  7. 【转】linux中执行外部命令提示" error while loading shared libraries"时的解决办法
  8. unity, dll is not allowed to be included or could not be found
  9. [Kubernetes]Kubernetes的网络模型
  10. JDK1.6新特性,基础类库篇,集合框架(Collections)