我是H2数据库的新手,我遇到了一个特殊的问题,我正在运行一个名为format的函数。
public static String format(Double sumValue,Integer decimalValue){
if(sumValue==null)
return null;
else{
//format in particular order.
}
}
sumValue有可能获得空值。
当我运行查询时,它会抛出以下异常
SELECT format(commamount,2) as formatted FROM pshipcommdetail [90105-153]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.message.DbException.convertInvocation(DbException.java:295)
at org.h2.engine.FunctionAlias$JavaMethod.getValue(FunctionAlias.java:405)
at org.h2.expression.JavaFunction.getValue(JavaFunction.java:38)
at org.h2.expression.Alias.getValue(Alias.java:35)
at org.h2.command.dml.Select.queryFlat(Select.java:519)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:614)
at org.h2.command.dml.Query.query(Query.java:269)
at org.h2.command.dml.Query.query(Query.java:239)
at org.h2.command.dml.Query.query(Query.java:37)
at org.h2.command.CommandContainer.query(CommandContainer.java:78)
at org.h2.command.Command.executeQuery(Command.java:181)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:278)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:137)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at reports.functions.Format.format(Format.java:15)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.h2.engine.FunctionAlias$JavaMethod.getValue(FunctionAlias.java:393)
我经历了documentation,并且能够弄清楚这些结果应该是包装类,因此我改为加倍!
请有人帮我弄清楚实际问题在哪里吗?
感谢你
关心 Phani Kumar
答案 0 :(得分:1)
在H2邮件列表上回答了这个问题: http://groups.google.com/group/h2-database/browse_thread/thread/a4105b923d79bf28# 这是Phani代码中的一个错误。