oracle里的date类型怎么查询呢? 一张表里面有个字段 A 是date类型存放的是日期和时分秒怎么查询日期在2012年2月1日的记录呢?select * from table where A='2012-02-01'吗显然不对 该怎么写呢 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不对,需要使用to_data()函数进行转换 select * from table where to_date(A)='2012-02-01'这么写? select * from table where to_char(A,'YYYY-MM-DD')='2012-02-01' select * from table where a=to_date('2012-02-01','yyyy-mm-dd') 这个是有点问题的,A字段一般不会是2012-02-01,一般默认会精确到秒...所以一般时间查询的时候,使用将时间转化为字符串比较,同三楼:select * from table where to_char(a,'yyyymmdd') = '20120201'; select * from tb1 where to_char(A,'yyyy-mm-dd')='2012-02-01' select * from table where A=To_Date('2012-02-01','YYYY-MM-DD'); SELECT * FROM TABLE WHERE A LIKE DATE '2012-02-01'; select * from table where to_char(A,'YYYY-MM-DD')='2012-02-01' http://www.cnblogs.com/chuncn/archive/2009/04/29/1381282.html把日期函数都熟悉一下 建议 where A between to_date('03-FEB-12 00:00:00','DD-MON-YY HH24:MI:SS') and to_date('03-FEB-12 23:59:59','DD-MON-YY HH24:MI:SS'); oracle执行计划问题 tnsping结果显示无监听器 游标的使用 ORA-00942: 表或视图不存在 blob字段显示问题 关于实例的疑问 刚安装oracle8i有一点小问题(在线急等望各位大侠多多帮忙) 转换字符集 在线急等 一个比较有意思的sql 语句!只用一个SQL 语句!要一定智力! 新手上马,扶一把吧,安装ORACLE问题 使用oracle出现下面问题,求高手指教?????? 怎样程序实现连接oracle数据源
这个是有点问题的,A字段一般不会是2012-02-01,一般默认会精确到秒...
所以一般时间查询的时候,使用将时间转化为字符串比较,同三楼:select * from table where to_char(a,'yyyymmdd') = '20120201';
select * from tb1 where to_char(A,'yyyy-mm-dd')='2012-02-01'
select * from table where A=To_Date('2012-02-01','YYYY-MM-DD');
把日期函数都熟悉一下 建议