File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Murach's Java Servlets and JSP this week in the Servlets 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( {
volume = rs.getLong(1);
s.addCell(new Number(2,rowNo,volume,cInt));
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

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:
subject: How to upper cast the average in db2 query?
Similar Threads
Oracle XMLType data size
Help in Query
Doubt in Sun's sample question
Urgent Help in Query
List of Database in J2ME