易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle时间查询

1.我一个表内有个date字段,存入的时候是  2009-12-21 16:41:53 这种格式,,
我想查询的时候,根据这个字段查询出 2009-12-21这一天的数据


我的sql 
select * from teaminfo t where RKSJC=to_date('2009-12-21','yyyy-MM-dd');
这样查不不出来,数据库中有数据..请帮助,,

2.还有就是如果是查询这种格式的指定日期之间的 数据.请帮下忙给个sql;
RKSJC >= to_date('2009-12-21','yyyy-MM-dd') and
RKSJC < to_date('2009-12-22','yyyy-MM-dd')

1
select * from teaminfo t where to_char(RKSJC,'yyyy-MM-dd')='2009-12-21';


2
select * from teaminfo t where to_char(RKSJC,'yyyy-MM-dd') between '2009-12-21' and '2009-12-31';

上面这样不能走索引,如果效率有问题,可以考虑在RKSJC建一个函数索引to_char(RKSJC,'yyyy-MM-dd')。

这个字段是日期格式还是varchar2 类型的?

select * from teaminfo where to_char(rksjc,'yyyymmdd')='20091221'

between '2009-12-21' and '2009-12-31';

select * from teaminfo t where RKSJC>=to_date('2009-12-21','yyyy-MM-dd');


SQL code:
select * from teaminfo t where RKSJC=to_date('2009-12-21','yyyy-MM-dd');
因为你的RKSJC是长日期格式的,结果肯定没有


相关问答:

是oracle的bug么?散分了! - Oracle / 基础和管理

本来要写个update语句
update table_a A
  set A.flag=1
  where A.id in (select B.id from table_b B)
结果误写成
update table_a A
  set A.flag=1
  where ......

Oracle 数据导出问题 - Oracle / 高级技术

exp user/password@dbname file=c:\table.dmp tables=jbitaku,jbitakum grants=y
然後按回車鍵 說明:  user/password@dbname  分別表示用戶名,密碼和服務名 f ......

oracle数据库 缓冲池 - Oracle / 基础和管理

请问这个缓冲池是怎么回事啊?可以连接缓冲池利用其中的数据吧?怎么用?
这个是oracle自动做的,一般应用程序是操作不了的。

不能直接连接吗?

引用
不能直接连接吗?
不能

那缓冲池里的数据也不能查询 ......

linux下C语言开发oracle的问题。

两个文件1.PC,1.inc
1.PC有操作oracle数据库的 ,1.inc也有操作oracle数据库 
在其他数据中如informix 中$include 1.inc就可以使用了
在ORACLE数据库重 $include 1.inc不可用 EXEC SQL include 1.inc也不可 ......

Windows 7 怎样安装Oracle - Oracle / 基础和管理

各位大哥,帮个忙。

下个Oracle for vista 版本的安装试试
10G和11G的 
http://www.oracle.com/technology/software/products/database/index.html 
------------------------------------------- ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号