getting a stupid cast error, dont see why

41 views
Skip to first unread message

petko

unread,
Feb 13, 2011, 11:40:25 PM2/13/11
to H2 Database
Data conversion error converting "+10"; SQL statement:
SELECT CAST("timeZoneString" as INT) FROM COUNTRY1 [90021-147]
90021/90021 (Help)
org.h2.jdbc.JdbcSQLException: Data conversion error converting "+10";
SQL statement:
SELECT CAST("timeZoneString" as INT) FROM COUNTRY1 [90021-147]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.value.Value.convertTo(Value.java:837)
at org.h2.expression.Function.getSimpleValue(Function.java:703)
at org.h2.expression.Function.getValueWithArgs(Function.java:852)
at org.h2.expression.Function.getValue(Function.java:416)
at org.h2.command.dml.Select.queryFlat(Select.java:504)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:597)
at org.h2.command.dml.Query.query(Query.java:257)
at org.h2.command.dml.Query.query(Query.java:227)
at org.h2.command.CommandContainer.query(CommandContainer.java:78)
at org.h2.command.Command.executeQuery(Command.java:132)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:278)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:137)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NumberFormatException: For input string: "+10"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at org.h2.value.Value.convertTo(Value.java:794)
... 12 more

at org.h2.engine.SessionRemote.done(SessionRemote.java:543)
at org.h2.command.CommandRemote.executeQuery(CommandRemote.java:
152)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:
174)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:153)
at org.h2.server.web.WebApp.getResult(WebApp.java:1316)
at org.h2.server.web.WebApp.query(WebApp.java:1004)
at org.h2.server.web.WebApp$1.next(WebApp.java:967)
at org.h2.server.web.WebApp$1.next(WebApp.java:970)
at org.h2.server.web.WebThread.process(WebThread.java:166)
at org.h2.server.web.WebThread.run(WebThread.java:93)
at java.lang.Thread.run(Thread.java:662)

petko

unread,
Feb 14, 2011, 11:04:03 PM2/14/11
to H2 Database
does any one know why this is not getting parsed? thanks in advance

Thomas Mueller

unread,
Feb 15, 2011, 2:23:41 PM2/15/11
to h2-da...@googlegroups.com
Hi,

H2 uses Integer.parseInt, and this doesn't work: Integer.parseInt("+10").

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages