Hitachi

Hitachi Advanced Database Application Development Guide


11.2.7 getPrecision(int param)

Organization of this subsection

(1) Function

This method acquires the number of digits in a specified parameter.

(2) Format

public synchronized int getPrecision(int param) throws SQLException

(3) Arguments

int param

Specifies a parameter number (beginning with 1).

(4) Return value

The method returns a decimal number indicating the number of digits in the specified parameter.

If the specified parameter is the numeric data type, the method returns the number of digits. If it is not the numeric data type, the method returns the parameter length in bytes. The following table shows the return values of the getPrecision method.

Table 11‒5: Return values of the getPrecision method

Parameter's data type (HADB data type)

Return value (column length in digits)

INTEGER

19

SMALLINT

10

DOUBLE PRECISION

17

DECIMAL(m,n)

m

CHAR(n)

VARCHAR(n)

n

DATE

10

TIME(p)

p = 0: 8

p > 0: 8 + (p + 1)

TIMESTAMP(p)

p = 0: 19

p > 0: 19 + (p + 1)

BINARY(n)

VARBINARY(n)

n

ROW

row-length#

#

Sum of the data lengths of all columns. For details about how to obtain the data length of a column, see Length of data storage in the topic List of data types in the manual HADB SQL Reference.

(5) Exceptions

If the specified param value is 0 or less, or is greater than the number of parameters, the JDBC driver throws an SQLException.