8.8.10 getPrecision(int column)
- Organization of this subsection
(1) Function
This method acquires a specified column's length (in digits).
(2) Format
public synchronized int getPrecision(int column) throws SQLException
(3) Arguments
- int column
-
Specifies a column number (where the first column is 1).
(4) Return value
The method returns the specified column's length in decimal digits. If the specified column has a numeric data type, the method returns the number of digits. If it does not have a numeric data type, the method returns the column length in bytes. The following table shows the return values of the getPrecision method.
|
Column'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 the topic List of data types in the manual HADB SQL Reference.
- #2
-
If the integer data type format is in legacy format, 19 is returned.
- #3
-
If the integer data type format is in legacy format, 10 is returned.
(5) Exceptions
If the specified column value is 0 or less, or is greater than the number of columns in the table, the JDBC driver throws an SQLException.