-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: aggregate functions
PostPosted: Mon Aug 09, 2004 6:04 am 
Newbie

Joined: Thu Aug 05, 2004 1:13 pm
Posts: 2
Hibernate version: 2.1.5

After:
select r.id, sum(w.CenaSp*z.Ilosc) from ...
error:
Hibernate: select rozliczeni0_.rozliczenie_id as x0_0_, sum(wzor2_.CenaSp*zamowienie1_.Ilosc) as x1_0_ from Rozliczenie rozliczeni0_ left outer join ZamowieniePozycja zamowienie1_ on rozliczeni0_.rozliczenie_id=zamowienie1_.zamowieniepozycja_id left outer join Wzor wzor2_ on zamowienie1_.wzor_id=wzor2_.wzor_id group by rozliczeni0_.rozliczenie_id
8912 [main] WARN util.JDBCExceptionReporter - SQL Error: 0, SQLState: HY002
8912 [main] ERROR util.JDBCExceptionReporter - Column name x2_0_ not found in result set.
8912 [main] WARN util.JDBCExceptionReporter - SQL Error: 0, SQLState: HY002
8912 [main] ERROR util.JDBCExceptionReporter - Column name x2_0_ not found in result set.
8922 [main] ERROR util.JDBCExceptionReporter - Could not execute query
org.firebirdsql.jdbc.FBSQLException: Column name x2_0_ not found in result set.
at org.firebirdsql.jdbc.FBResultSet.findColumn(FBResultSet.java:694)
at org.firebirdsql.jdbc.FBResultSet.getField(FBResultSet.java:401)
at org.firebirdsql.jdbc.FBResultSet.getInt(FBResultSet.java:457)


select r.id, sum(w.CenaSp+z.Ilosc) from ...
Works fine

Tested databases: HSQLDB and FirebirdSQL[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 6:25 am 
Beginner
Beginner

Joined: Tue Mar 30, 2004 5:54 am
Posts: 22
Location: Bangalore
It seems one of the element is retriving null ... try using NVL(Oracle function)... as in

select r.id, sum(Nvl(w.CenaSp,0) * Nvl(z.Ilosc,0)) from ...

_________________
Thanks
Irfani


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.