【问题标题】:Informix datetime with prepared statement带有准备好的语句的 Informix 日期时间
【发布时间】:2013-10-18 11:57:19
【问题描述】:

我正在这样做:

Select count(*) from table1 t where start_datetime = datetime(?);

设置日期时间使用:

ps.setString("01-01-2010 12:12:00.123")

它给出的错误是:日期时间或间隔中的非数字字符。

但是,如果我在 SQL 编辑器中将其作为 SQL 运行,则一切正常。

任何线索如何纠正这个?

【问题讨论】:

  • 非常感谢。

标签: sql datetime informix


【解决方案1】:

更改字符串以符合默认的datetime 日期模式

ps.setString("2010-01-01 12:12:00.1230")

我认为这样的事情也应该有效

select count(*) from table1 t 
               where start_datetime = TO_DATE(?,"%Y-%m-%d %H:%M:%S %F3")

告诉我

【讨论】:

    猜你喜欢
    • 2012-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    • 2012-10-10
    • 2011-09-11
    相关资源
    最近更新 更多