Java examples for java.lang:double
This method retrieves a Double value from the resultset at the given column.
//package com.java2s; import java.sql.ResultSet; import java.sql.SQLException; public class Main { /**//from ww w . j a v a2 s . co m * This method retrieves a Double value from the resultset at the given * column. If the column's value is null, null is returned, else a new * Double object containing the double value is returned. * @param result The result from which the value is to be retrieved. * @param columnIndex The index of the column from which the value is to * be retrieved. * @return If the column's value is null, null; else a new Double object * containing the double value in the column. * @throws SQLException Indicates an error retrieving the data from the * ResultSet. */ public static Double getNullableDouble(ResultSet result, int columnIndex) throws SQLException { double d = result.getDouble(columnIndex); if (result.wasNull()) { return null; } else { return new Double(d); } } }