Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to upper cast the average in db2 query?

 
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));
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aypa, please check your private messages for an important administrative matter.
 
Tell me how it all turns out. Here is a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic