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)

BIGINT

19

INTEGER#2

10

SMALLINT#3

5

DOUBLE PRECISION

FLOAT

17

REAL

8

DECIMAL(m,n)

NUMERIC(m,n)

m

CHAR(n)

VARCHAR(n)

n

STRING

32,000,000

DATE

10

TIME(p)

p = 0: 8

p > 0: 8 + (p + 1)

TIMESTAMP(p) WITHOUT TIME ZONE

p = 0: 19

p > 0: 19 + (p + 1)

TIMESTAMP(p) WITH TIME ZONE

p = 0: 25

p > 0: 25 + (p + 1)

BINARY(n)

VARBINARY(n)

n

ROW

row-length#1

BOOLEAN

1

UUID

16

#1

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.

#2

If the data format of the integer data type is legacy format, 19 is returned.

#3

If the data format of the integer data type is legacy format, 10 is returned.

(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.