时间格式有误,不知是何原因?

happyxhl 2003-08-05 11:08:13
在基础版中问过,没太多人回答。有关ORACLE的,来此求教。

在执行一个SQL语句并用Grid显示时,查询某个条件时总是报错:Project DeptPlan.exe raised exception class EDBEngineError with message "Invalid Time".Process Stopped.Use Step or Run to continue.
好象说是我的某个时间字段有问题,请问各位是什么原因啊?

是不是我的时间格式有问题啊,可能是我的某条记录的时间有问题,有人碰到过类似问题吗?
...全文
59 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
happyxhl 2003-09-05
  • 打赏
  • 举报
回复
dtliupeng(吉利) ,bzszp(SongZip):
不是啊,执行起来都是没问题的,数据也查出来了,但是如果你滚动DBGrid时,有时就会出来上述错误了,是不是基其中的某条记录有问题呢?
bzszp 2003-08-07
  • 打赏
  • 举报
回复
如果a.defer_time是date类型的
a.defer_time>0,这样用是错误的
改成
a.defer_time is not null
dtliupeng 2003-08-07
  • 打赏
  • 举报
回复
你的date_from和date_to参数的时间格式和to_date()函数的格式不一致,
你必须保证date_from 也是YYYY-MM-DD的格式才能比较.
happyxhl 2003-08-06
  • 打赏
  • 举报
回复
不好意思,今天才来回贴。
SQL语句如下:
select a.*,b.work_order_number,b.priority_code,c.customer_part_number,
d.dept_code,d.dept_name
from plan_stepitem a,data0006 b,data0050 c,data0034 d
where a.wo_ptr=b.rkey
and b.cust_part_ptr=c.rkey
and a.dept_ptr=d.rkey
and a.defer_time>0
and a.ttype=0
and d.dept_code like :dept_code
and c.customer_part_number like :customer_part_number
and to_date(to_char(a.sch_compl_date,'YYYY-MM-DD'),'YYYY-MM-DD')
between :date_from and :date_to
程序如下:
With Query1 Do
Begin
if Active Then
Close;
ParamByName('date_from').Value:=DateTimePicker1.Date;
ParamByName('date_to').Value:=DateTimePicker1.Date;
ParamByName('dept_code').asstring:=Edit6.Text+'%';
ParamByName('customer_part_number').asstring:=Edit7.Text+'%';
Open;
End;
bzszp 2003-08-05
  • 打赏
  • 举报
回复
数据库保存的是date类型的吗?
dihai2000 2003-08-05
  • 打赏
  • 举报
回复
某个时间字段 ,贴出SQL
huangcaibing 2003-08-05
  • 打赏
  • 举报
回复
把sql语句写出来
yangcracy2003 2003-08-05
  • 打赏
  • 举报
回复
注意你的时间格式,oracle 的sql语句对这个很苛刻的
最好是把你的源程序写出来描一下。

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧