java.sql.SQLException:数字溢出

时间:2014-03-18 11:39:31

标签: java jsf-2 oracle11g

我正在使用JSF在同一页面上构建饼图和条形图,并且两个组件都从此查询中获取信息:

select 'ACCOUNTS'PRODUCT,sum(ACCT_BAL_LCY) AMOUNT from account_master where schm_type in(?, ?, ?,?) and ACCT_BAL_LCY >0 
union select 'BILLS'PRODUCT, sum(LIAB_AMT_LCY)AMOUNT from bills_details union select 'DOCUMENTARY CREDITS'PRODUCT,sum(LIAB_AMOUNT)AMOUNT 
from DC_DETAILS union select 'GUARANTEES'PRODUCT, sum(LIAB_AMT_LCY)AMOUNT from BG_DETAILS;

执行它的方法是:

 private void createPieModel() {
        pieModel = new PieChartModel();
        categoryModel = new CartesianChartModel();
        ChartSeries act = new ChartSeries();
        act.setLabel("Product Types");
        Connection conn;
        db = new DBConnection();
        conn = db.getDbConnection();
        pr = new BiProperties();
        try {
            String sql = pr.getDBProperty().getProperty("liability.bank");
            PreparedStatement ps = conn.prepareStatement(sql);
            ps.setString(1, "SBA");
            ps.setString(2, "CAA");
            ps.setString(3, "TDA");
            ps.setString(4, "CCA");
            ResultSet rs = ps.executeQuery();
            int i = 0;
            while (rs.next()) {
                pieModel.set(rs.getString(1), rs.getInt(2));
                act.set(rs.getString(1), rs.getInt(2));//Error on this Line
                cities.put(i, rs.getString(1));
                i++;

            }
            categoryModel.addSeries(act);

        } catch (SQLException asd) {
            log.debug(Level.FATAL, asd);
        }
    }

有时两个图表显示at,时间没有显示图表,有时只显示饼图Show。在检查后端时,我收到此错误:

java.sql.SQLException: Numeric Overflow

我怎样才能避免这种情况,因为它会随机发生?

1 个答案:

答案 0 :(得分:0)

我怀疑它是由SQL中的聚合函数抛出的 默认情况下,AFAIR将定义一个变量,以将聚合函数结果保存为与此函数的参数相同的类型。您可能希望将其重新定义为SQL中更高的精度/大小变量。