Hitachi

Hitachi Advanced Database Application Development Guide


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.

Table 8‒36: Relationship between the retrieval result and the return value (getTimestamp method)

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: