Hitachi

Hitachi Advanced Database Application Development Guide


8.5.46 getShort(int columnIndex)

Organization of this subsection

(1) Function

This method acquires as short in the Java programming language 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 short getShort(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.

Table 8‒33: Relationship between the retrieval result and the return value (getShort method)

HADB data type

Retrieval result

Return value

CHAR

VARCHAR

Null value

0

[space]integer-in-character-string-representation, decimal-number-in-character-string-representation, or floating-point-number-in-character-string-representation[space], and Short.MIN_VALUE or greater, and Short.MAX_VALUE or less

Integer part of the retrieval result converted to a short value

[space]integer-in-character-string-representation, decimal-number-in-character-string-representation, or floating-point-number-in-character-string-representation[space], and greater than Short.MAX_VALUE or less than Short.MIN_VALUE

SQLException is thrown.

[space]-Infinity[space]

[space][+]Infinity[space]

[space][+|-]NaN[space]

Other than the above (cannot be converted to a double value)

SMALLINT

Null value

0

Short.MIN_VALUE or greater and Short.MAX_VALUE or less

Retrieval result converted to a short value

Other than the above

SQLException is thrown.

INTEGER

Null value

0

Short.MIN_VALUE or greater and Short.MAX_VALUE or less

Retrieval result converted to a short value

Other than the above

SQLException is thrown.

DECIMAL

Null value

0

Short.MIN_VALUE or greater and Short.MAX_VALUE or less

Integer part of the retrieval result converted to a short value

Other than the above

SQLException is thrown.

DOUBLE PRECISION

Null value

0

Short.MIN_VALUE or greater and Short.MAX_VALUE or less

Integer part of the retrieval result converted to a short value

Other than the above

SQLException is thrown.

BOOLEAN#

Null value

0

true

1

false

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: