8.5.11 getBigDecimal(int columnIndex)
- Organization of this subsection
(1) Function
This method acquires in a java.math.BigDecimal object the value in a specified column in the current row of the ResultSet object. The column whose value is to be acquired is specified in the argument.
(2) Format
public synchronized BigDecimal getBigDecimal(int columnIndex) throws SQLException
(3) Arguments
- int columnIndex
-
Specifies a column number.
(4) Return value
This method returns the column value that corresponds to the specified column number in the current row. The following table shows the relationship between the retrieval result and the return value.
HADB data type |
Retrieval result |
Return value |
---|---|---|
CHAR VARCHAR |
Null value |
null |
[space]integer-in-character-string-representation, decimal-number-in-character-string-representation, or floating-point-number-in-character-string-representation [space] |
java.math.BigDecimal object containing the retrieval result (the value without the spaces at the beginning and end of the character string is used as the java.math.BigDecimal object) |
|
Other than the above |
SQLException is thrown. |
|
SMALLINT |
Null value |
null |
Other than the above |
java.math.BigDecimal object containing the retrieval result |
|
INTEGER |
Null value |
null |
Other than the above |
java.math.BigDecimal object containing the retrieval result |
|
DECIMAL |
Null value |
null |
Other than the above |
java.math.BigDecimal object containing the retrieval result |
|
DOUBLE PRECISION |
Null value |
null |
Other than the above |
java.math.BigDecimal object containing the retrieval result |
|
BOOLEAN# |
Null value |
null |
true |
java.math.BigDecimal object obtained based on BigDecimal(1) |
|
false |
java.math.BigDecimal object obtained based on BigDecimal(0) |
|
Other |
Not applicable |
SQLException is thrown. |
- #
-
BOOLEAN-type data exists when the ResultSet object was created from DatabaseMetadata.
(5) Exceptions
The JDBC driver throws an SQLException in the following cases:
-
This ResultSet object is closed.
This includes the case where the ResultSet object was closed because the Statement object that created this ResultSet object was closed.
-
The Connection used to create the Statement object that created this ResultSet object has been closed.
-
The ResultSet object has become invalid due to transaction settlement.
-
A nonexistent column number was specified.
-
The data type cannot be acquired by this method.
-
The column value cannot be acquired as BigDecimal.
-
An error occurred in the JDBC driver.