• Java,PostgreSQL时间范围查询


    遇到一坑:对于如下代码

    select * from order_mileagefuel where date > '2015-11-1' and date< '2015-11-5' 

    在PostgreSQL的客户端中执行时能得到结果,但在Java中执行时(此时时间范围是参数,类型为String),如date &gt;=#{startDay} and date &lt;=#{endDay}

    执行时报如下错误:(而对于MySQL,在代码中却是能够正确执行的。)

    ERROR: operator does not exist: timestamp without time zone > character varying

    解决方法:将String类型的参数改为java.sql.Timestamp

  • 相关阅读:
    API和String
    集合
    类和对象
    多态
    内部类
    继承
    抽象类
    常用API
    包和修饰符
    异常
  • 原文地址:https://www.cnblogs.com/z-sm/p/5155659.html
Copyright © 2020-2023  润新知