8.5.55 getTimestamp(int columnIndex)
- Organization of this subsection
(1) Function
This method acquires in a java.sql.Timestamp 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 java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException
(3) Arguments
- int columnIndex
-
Specifies a column number.
(4) Return value
This method returns the column value. The following table shows the relationship between the retrieval result and the return value.
For details about the conversion for DATE, TIME, TIMESTAMP, or character string type (CHAR or VARCHAR), see (2) Data conversion process during execution of a getXXX method (for DATE, TIME, TIMESTAMP, or character string type) in 7.6.2 Data conversion process.
HADB data type |
Retrieval result |
Return value |
---|---|---|
CHAR VARCHAR |
Null value |
null |
[space]formatted-time-stamp#[space] |
Retrieval result converted to a java.sql.Timestamp object without the spaces at the beginning and end of the retrieval result |
|
Other than the above |
SQLException is thrown. |
|
DATE |
Null value |
null |
Other than the above |
Retrieval result converted to a java.sql.Timestamp object |
|
TIME |
Null value |
null |
Other than the above |
Retrieval result converted to a java.sql.Timestamp object |
|
TIMESTAMP |
Null value |
null |
Other than the above |
Retrieval result converted to a java.sql.Timestamp object |
|
Other |
Not applicable |
SQLException is thrown. |
- #
-
formatted-time-stamp is a character string in the time stamp format 'YYYY-MM-DD hh:mm:ss[.f...]'.
(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 java.sql.Timestamp.
-
An error occurred in the JDBC driver.