-->
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.  [ 1 post ] 
Author Message
 Post subject: How to multiply and sum two values using HQL. - HELP ASAP!
PostPosted: Mon Jul 18, 2005 5:12 pm 
Newbie

Joined: Tue Nov 30, 2004 2:37 pm
Posts: 16
I am trying to run a Hibernate Query to multiply and sum two values grouped by another values, I constantly keep getting SQLState = Null Invalid column Name errors...

select poee.descrip,
sum(qi.volume),
sum(qi.volume * qi.avgCost)
from trans as q
joins... here...
where d.termType = :termType..
and "some date range "...
group by and order by are there...

etc...

This is how I executed this query it runs first for the first date range, for the second date range I get the error given below. Then I assumed it has something to do with null value when trying to multiply null and a non-null value, and I substitued with oracle "nvl" as given below;

I tried first like this;

sum(nvl(qi.volume, 0.00) * nvl(qi.avgCost, 0.00)) and also this,

sum(nvl(qi.volume, doubleVal) * nvl(qi.avgCost, doubleVal))

both are not working, CAN SOMEONE PLEASE HELP ME!. I need to finish this ASAP.

0:00:00 EDT 2005
18 Jul 17:04 DEBUG BaseReport - Here 2.
18 Jul 17:04 WARN JDBCExceptionReporter - SQL Error: 17006, SQLState: null
18 Jul 17:04 ERROR JDBCExceptionReporter - Invalid column name
18 Jul 17:04 WARN JDBCExceptionReporter - SQL Error: 17006, SQLState: null
18 Jul 17:04 ERROR JDBCExceptionReporter - Invalid column name
18 Jul 17:04 ERROR JDBCExceptionReporter - Could not execute query
java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:187)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:229)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:292)

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp


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

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.