public int bInf3( Connection conn, String ym ) ... { int goukei_jikan = 0 ; ResultSet rs = null ; try ...{ String sql = "select months_between(trunc(sysdate,'mm'),to_date('" + ym + "','yyyyMM')) as "; sql += "month from dual" ; PreparedStatement stmt = conn.prepareStatement( sql ) ; //実行 rs = stmt.executeQuery() ; if ( rs.next() ) ...{ goukei_jikan = rs.getInt( "month" ) ; } rs.close() ; stmt.close() ; } catch ( Exception e ) ...{ e.printStackTrace() ; } return goukei_jikan ; }