The exception is coming from inside your format method.
Look at line 15 of your Format class.
phani wrote:
> Hi,
>
> I am new to H2 database, I ran into a particular problem where I was
> running a function named format.
>
> public static String format(Double sumValue,Integer decimalValue){
> if(sumValue==null)
> return null;
> else{
> //format in particular order.
> }
> }
> There are chances of sumValue getting null value.
>
> when I am running a query it is throwing a following exception
>
> 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)
>
> I went through the documentation and was able to figure out that the
> aruguments should be of wrapper class hence I changed to Double but it
> didnt work!
>
> Can anyone of you please help me to figure out where the actual
> problem is?
>
> Thanking you
>
> With Regards
> Phani Kumar
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.