wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to upper cast the average in db2 query? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to upper cast the average in db2 query?" Watch "How to upper cast the average in db2 query?" New topic

How to upper cast the average in db2 query?

aypa genga

Joined: Nov 26, 2008
Posts: 5
Hi all,

Below is the query :

i am getting SQL0802N Arithmetic overflow or other arithmetic exception occurred. SQLSTATE=22003 error in the below query for avg calculation.
The DUR_MILLISCNDS_CNT is integer.
Can Upper casting the average solve the error. How to upper Cast average.
Can you please help me in this.
try {
String sQuery="SELECT " +"Count(*) As DAILY_VOLUME, " +
"FROM " + dbName + ".TCAOP_MTRCS " +
"WHERE DATE( SESS_TS ) BETWEEN '" + fromDate + "' AND '" + toDate + "' " +
"AND RQST_DSCR ='" + componentList.get(i) +"' with ur";
// System.out.println("QRY === " + sQuery);
if(rs.next()) {
volume = rs.getLong(1);
s.addCell(new Number(2,rowNo,volume,cInt));
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13883

aypa, please check your private messages for an important administrative matter.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
I agree. Here's the link: http://aspose.com/file-tools
subject: How to upper cast the average in db2 query?
Similar Threads
Help in Query
Doubt in Sun's sample question
Urgent Help in Query
Oracle XMLType data size
List of Database in J2ME