【问题标题】:hsqldb indexOutOfBoundExceptionhsqldb indexOutOfBoundException
【发布时间】:2015-04-25 08:42:56
【问题描述】:

我有一个关系,它有大约 5000 条记录。

问题

假设我有 1 条记录:

姓名:“亚当”,家庭:“白”,数据:“003*12/12/12”, 父亲:'杰克'

当我搜索时:

select * from tbl_r1 where 1=1 and father='adam';//return 0 record

select * from tbl_r1 where 1=1 and father='jack';//return 1 record

效果很好,但是:

select * from tbl_r1 where 1=1 and father='adam' and     
CONVERT(substring(data from 1 for 3),BigInt)= 3;

它抛出异常“

StringIndexOutOfBoundsException :-7" 或 -80

等等

这个查询在 postgresql 中没问题,因为我是按父亲名字过滤的...

【问题讨论】:

    标签: postgresql hsqldb indexoutofboundsexception


    【解决方案1】:

    这适用于最新版本的 HSQLDB (2.3.3)。

    【讨论】:

    • 我切换到新版本但它抛出了新异常 java.sql.SQLDataException: data exception: invalid character value for cast
    • substring(data from 1 for 3) 只能包含数字。抛出异常是因为在某些行中此子字符串还包含其他字符..
    • 是的,你说得对,但不可否认的问题是这个过滤器没有记录father = 'adam'
    • 我想,我必须在我的应用程序中搜索,thx fredt 以便快速响应
    猜你喜欢
    • 1970-01-01
    • 2014-09-10
    • 2016-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-14
    • 2015-01-02
    相关资源
    最近更新 更多