CallableStatement cstmt = null;
int affectedRows = -1;
int sequence = -1;
try {
cstmt = conn.prepareCall("{call portal_get_sequence(?,?,?)}");
cstmt.setString(1, tableName);
cstmt.setString(2, columnName);
cstmt.registerOutParameter(3, Types.INTEGER);
affectedRows = cstmt.executeUpdate();
sequence = cstmt.getInt(3);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (cstmt != null) {
cstmt.close();
}
} catch (SQLException e) {
// e.printStackTrace();
System.err.println(e.getMessage());
}
}