• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to upper cast the average in db2 query?

 
aypa genga
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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, " +
"AVG( DUR_MILLISCNDS_CNT) AVERAGE_RESPONSE_TIME, " + ---- error occured----
"MIN ( DUR_MILLISCNDS_CNT) MINIMUM_RESPONSE_TIME, " +
"MAX ( DUR_MILLISCNDS_CNT) MAXIMUM_RESPONSE_TIME " +
"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);
stmt=con.createStatement();
rs=stmt.executeQuery(sQuery);
if(rs.next()) {
String.valueOf(rs.getString("DAILY_VOLUME"));
volume = rs.getLong(1);
s.addCell(new Number(2,rowNo,volume,cInt));
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15627
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aypa, please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic