public enum OracleType extends java.lang.Enum<OracleType> implements java.sql.SQLType
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getName() |
java.lang.String |
getVendor() |
java.lang.Integer |
getVendorTypeNumber() |
boolean |
isNationalCharacterSet()
Does this type use the national character set?
|
boolean |
isSupported()
Does this driver support this database type?
|
static OracleType |
toOracleType(int oracleTypesConst)
Returns the OracleType corresponding to the int constant defined in
OracleTypes. |
static OracleType |
toOracleType(java.sql.SQLType sqlType)
Returns the OracleType corresponding to SQLType.
|
static OracleType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static OracleType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final OracleType VARCHAR2
public static final OracleType NVARCHAR
public static final OracleType NUMBER
public static final OracleType FLOAT
public static final OracleType LONG
public static final OracleType DATE
public static final OracleType BINARY_FLOAT
public static final OracleType BINARY_DOUBLE
public static final OracleType TIMESTAMP
public static final OracleType TIMESTAMP_WITH_TIME_ZONE
public static final OracleType TIMESTAMP_WITH_LOCAL_TIME_ZONE
public static final OracleType INTERVAL_YEAR_TO_MONTH
public static final OracleType INTERVAL_DAY_TO_SECOND
public static final OracleType PLSQL_BOOLEAN
public static final OracleType RAW
public static final OracleType LONG_RAW
public static final OracleType ROWID
public static final OracleType UROWID
public static final OracleType CHAR
public static final OracleType NCHAR
public static final OracleType CLOB
public static final OracleType NCLOB
public static final OracleType BLOB
public static final OracleType BFILE
public static final OracleType JSON
public static final OracleType BOOLEAN
public static final OracleType OBJECT
public static final OracleType REF
public static final OracleType VARRAY
public static final OracleType NESTED_TABLE
public static final OracleType ANYTYPE
public static final OracleType ANYDATA
public static final OracleType ANYDATASET
public static final OracleType XMLTYPE
public static final OracleType HTTPURITYPE
public static final OracleType XDBURITYPE
public static final OracleType DBURITYPE
public static final OracleType SDO_GEOMETRY
public static final OracleType SDO_TOPO_GEOMETRY
public static final OracleType SDO_GEORASTER
public static final OracleType ORDAUDIO
public static final OracleType ORDDICOM
public static final OracleType ORDDOC
public static final OracleType ORDIMAGE
public static final OracleType ORDVIDEO
public static final OracleType SI_AVERAGE_COLOR
public static final OracleType SI_COLOR
public static final OracleType SI_COLOR_HISTOGRAM
public static final OracleType SI_FEATURE_LIST
public static final OracleType SI_POSITIONAL_COLOR
public static final OracleType SI_STILL_IMAGE
public static final OracleType SI_TEXTURE
public static final OracleType VECTOR
A VECTOR that may contain any dimension type: FLOAT64, FLOAT32, INT8, or BINARY. This type represents a VECTOR declared with "*" as its dimension type, as in "VECTOR(100, *)"
The int constant corresponding to this SQLType is
OracleTypes.VECTOR.
Many Java/SQL conversions specified in this section are not applicable to
the BINARY dimension type. Only boolean[] and
byte[] conversions are supported for the
VECTOR_BINARY type.
Instances of the following classes may be passed to the
setObject methods of PreparedStatement and
CallableStatement if the target SQL type is specified as
OracleType.VECTOR or OracleTypes.VECTOR:
double[] is converted to a VECTOR of DENSE
FLOAT64 dimensions.
float[] is converted to a VECTOR of DENSE
FLOAT32 dimensions.
byte[] is converted to a VECTOR of DENSE
INT8 dimensions.
boolean[] is converted to a VECTOR of DENSE
BINARY dimensions.
VECTOR.SparseDoubleArray is converted to
a VECTOR of SPARSE FLOAT64 dimensions.
VECTOR.SparseFloatArray is converted to a
VECTOR of SPARSE FLOAT32 dimensions.
VECTOR.SparseByteArray is converted to a
VECTOR of SPARSE INT8 dimensions.
VECTOR.SparseBooleanArray is converted to a
VECTOR of SPARSE BINARY dimensions.
All conversions listed above are lossless.
Any of the following classes may be passed to the getObject
methods of ResultSet and CallableStatement when
OracleTypes.VECTOR is returned by
ResultSetMetaData.getColumnType(int) or
ParameterMetaData.getParameterType(int):
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
String
java.sql.Clob
oracle.sql.VECTOR
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions to float[], long[],
int[], short[], byte[],
SparseFloatArray, and SparseByteArray may
lose information as a
narrowing conversion is applied to each FLOAT64 value, as if converting
a double into the component type of the array class.
Conversions to long[], int[],
short[], byte[], and
SparseByteArray may lose information as a
narrowing conversion is applied to each FLOAT32 value, as if
converting a float into the component type of the array class.
Conversions to boolean[] and SparseBooleanArray
map a value of 0 to false and all other values to
true.
Conversions to String return the VARCHAR literal expression of
the VECTOR. The String for a DENSE VECTOR expresses the value of each
dimension: [value0,value1,...]. The String for a SPARSE VECTOR
expresses the total length of dimensions, followed by the indices
of dimensions having non-zero values, followed by the non-zero values:
[length,[indices],[non-zero-values]].
Conversions to Clob return an instance of Clob
which reads the same VARCHAR literal expression that would result from a
conversion to String. The returned Clob is
read-only.
The "preferred" array class for SQL to Java conversions is
double[], but this may not be a sensible choice for all
dimension types. The double[] conversion is "preferred" only
because a double can store the value of any dimension type
without losing information.
An easy problem to see is how memory gets wasted when FLOAT32, INT8, or
BINARY dimensions are stored using a 64-bit double.
A more concerning issue arises when JDBC converts
integer valued dimensions into double values. JDBC performs
that conversion as if by casting the integer to a double. For
example, the integer "9" becomes the double "9.0". It is unlikely that any
ML model would recognize the double[] which results from this
conversion. Typically, a quantization technique would be used to represent
floating point dimensions as integers; This is not what JDBC is doing.
Programmers are encouraged to make use of a conversion to the
VECTOR class when a SQL operation may result in VECTOR
data of non-uniform dimension types. When VECTOR data is converted into
a VECTOR object, the VECTOR.getType()
method can be used to identify the dimension type of an individual VECTOR.
A call to one the various to... methods can then convert the
VECTOR data into an appropriate format, as shown in this example:
void example(ResultSet resultSet) throws SQLException {
while (resultSet.next()) {
VECTOR vector = resultSet.getObject("vector", VECTOR.class);
if (vector == null)
continue;
switch (vector.getType()) {
case VECTOR_FLOAT64:
double[] doubles = vector.toDoubleArray();
handleFloat64(doubles);
break;
case VECTOR_FLOAT32:
float[] floats = vector.toFloatArray();
handleFloat32(floats);
break;
case VECTOR_INT8:
byte[] bytes = vector.toByteArray();
handleInt8(bytes);
break;
case VECTOR_BINARY:
byte[] packedBits = vector.toByteArray();
handleBinary(packedBits);
break;
default:
handleUnknown(vector.stringValue());
break;
}
}
}
public static final OracleType VECTOR_INT8
A VECTOR that contains signed 8-bit integers. This type represents
a VECTOR declared with INT8 as its dimension type, as in
VECTOR(100, INT8).
The int constant corresponding to this SQLType is
OracleTypes.VECTOR_INT8.
The preferred array class for all conversions is byte[], as a
byte can store any INT8 value in the least number of bits
without losing information.
Instances of the following classes may be passed to the
setObject methods of PreparedStatement and
CallableStatement if the target SQL type is specified as
OracleType.VECTOR_INT8 or
OracleTypes.VECTOR_INT8:
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions of double[], float[],
long[], int[], short[],
SparseDoubleArray, and SparseFloatArray may lose
information as a
narrowing conversion
is applied to each value of the array, as if converting the component type
of the array into a byte.
Conversions of byte[] and SparseByteArray do not
lose information.
Conversions of boolean[] and SparseBooleanArray
map a value of true to 1 and a value of false to
0.
Any of the following classes may be passed to the getObject
methods of ResultSet and CallableStatement when
OracleTypes.VECTOR_INT8 is returned by
ResultSetMetaData.getColumnType(int) or
ParameterMetaData.getParameterType(int):
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
String
java.sql.Clob
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions to double[], float[],
long[], int[], short[],
byte[], SparseDoubleArray,
SparseFloatArray, and SparseByteArray do not lose
information.
Conversions to boolean[] and SparseBooleanArray
map a value of 0 to false, and all other values to
true.
Conversions to String return the VARCHAR literal expression of
the VECTOR. The String for a DENSE VECTOR expresses the value of each
dimension: [value0,value1,...]. The String for a SPARSE VECTOR
expresses the total length of dimensions, followed by the indices
of dimensions having non-zero values, followed by the non-zero values:
[length,[indices],[non-zero-values]].
Conversions to Clob return an instance of Clob
which reads the same VARCHAR literal expression that would result from a
conversion to String. The returned Clob is
read-only.
public static final OracleType VECTOR_FLOAT32
A VECTOR that contains 32-bit floating point numbers. This type represents
a VECTOR declared with FLOAT32 as its dimension type, as in
VECTOR(100, FLOAT32).
The int constant corresponding to this SQLType is
OracleTypes.VECTOR_FLOAT32.
The preferred array class for all conversions is float[], as a
float can store any FLOAT32 value in the least number of bits
without losing information.
Instances of the following classes may be passed to the
setObject methods of PreparedStatement and
CallableStatement if the target SQL type is specified as
OracleType.VECTOR_FLOAT32 or
OracleTypes.VECTOR_FLOAT32:
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions of double[] and SparseDoubleArray may
lose information as a
narrowing conversion is applied to each value of the array, as if
converting a double into a float.
Conversions of long[] and int[] may lose
information as a
widening conversion
is applied to each value of the array, as if converting the component
type of the array into a float.
Conversions of float[], short[], and
byte[], SparseFloatArray, and
SparseByteArray do not lose information.
Conversions of boolean[] and SparseBooleanArray
map a value of true to 1 and a value of false to
0.
Any of the following classes may be passed to the getObject
methods of ResultSet and CallableStatement when
OracleTypes.VECTOR_FLOAT32 is returned by
ResultSetMetaData.getColumnType(int) or
ParameterMetaData.getParameterType(int):
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
String
java.sql.Clob
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions to long[], int[],
short[], byte[], and SparseByteArray
may lose information as a
narrowing conversion
is applied to each FLOAT32 value, as if converting a
float into the component type of the array.
Conversions to double[], float[],
SparseDoubleArray, and SparseFloatArray do not
lose information.
Conversions to boolean[] and SparseBooleanArray
map a value of 0 to false, and all other values to
true.
Conversions to String return the VARCHAR literal expression of
the VECTOR. The String for a DENSE VECTOR expresses the value of each
dimension: [value0,value1,...]. The String for a SPARSE VECTOR
expresses the total length of dimensions, followed by the indices
of dimensions having non-zero values, followed by the non-zero values:
[length,[indices],[non-zero-values]].
Conversions to Clob return an instance of Clob
which reads the same VARCHAR literal expression that would result from a
conversion to String. The returned Clob is
read-only.
public static final OracleType VECTOR_FLOAT64
A VECTOR that contains 64-bit floating point numbers. This type represents
a VECTOR declared with FLOAT64 as its dimension type, as in
VECTOR(100, FLOAT64).
The int constant corresponding to this SQLType is
OracleTypes.VECTOR_FLOAT64.
The preferred array class for all conversions is double[], as
a double can store any FLOAT64 value in the least number of
bits without losing information.
Instances of the following classes may be passed to the
setObject methods of PreparedStatement and
CallableStatement if the target SQL type is specified as
OracleType.VECTOR_FLOAT64 or
OracleTypes.VECTOR_FLOAT64:
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions of long[] may lose information as a
widening conversion
is applied to each value of the array, as if converting a
long into double.
Conversions of double[], float[],
int[], short[], byte[],
SparseDoubleArray, SparseFloatArray, and
SparseByteArray do not lose information.
Conversions of boolean[] and SparseBooleanArray
map a value of true to 1 and a value of false to
0.
Any of the following classes may be passed to the getObject
methods of ResultSet and CallableStatement when
OracleTypes.VECTOR_FLOAT64 is returned by
ResultSetMetaData.getColumnType(int) or
ParameterMetaData.getParameterType(int):
double[]
float[]
long[]
int[]
short[]
byte[]
boolean[]
String
java.sql.Clob
VECTOR.SparseDoubleArray
VECTOR.SparseFloatArray
VECTOR.SparseByteArray
VECTOR.SparseBooleanArray
Conversions to float[], long[],
int[], short[], byte[],
SparseFloatArray, and SparseByteArray may lose
information as a
narrowing conversion
is applied to each FLOAT64 value, as if converting
a double into the component type of the array.
Conversions to double[] and SparseDoubleArray do
not lose information.
Conversions to boolean[] and SparseBooleanArray
map a value of 0 to false, and all other values to
true.
Conversions to String return the VARCHAR literal expression of
the VECTOR. The String for a DENSE VECTOR expresses the value of each
dimension: [value0,value1,...]. The String for a SPARSE VECTOR
expresses the total length of dimensions, followed by the indices
of dimensions having non-zero values, followed by the non-zero values:
[length,[indices],[non-zero-values]].
Conversions to Clob return an instance of Clob
which reads the same VARCHAR literal expression that would result from a
conversion to String. The returned Clob is
read-only.
public static final OracleType VECTOR_BINARY
A VECTOR that contains unsigned 8-bit integers, where each bit stores
one dimension. This type represents a VECTOR declared with
BINARY as its dimension type, as in
VECTOR(128, BINARY).
The int constant corresponding to this SQLType is
OracleTypes.VECTOR_BINARY.
The preferred array class for all conversions is byte[], as
a byte can store 8 BINARY values in the least number of
bits without losing information.
Instances of the following classes may be passed to the
setObject methods of PreparedStatement and
CallableStatement if the target SQL type is specified as
OracleType.VECTOR_BINARY or
OracleTypes.VECTOR_BINARY:
byte[]
boolean[]
VECTOR.SparseBooleanArray
Conversions of byte[] unpack 8 bits from each
byte in MSB order, such that the highest bit is stored at a
lower dimension within the VECTOR. The number of dimensions in the VECTOR
is the length of the byte[] multiplied by 8.
Conversions of boolean[] and SparseBooleanArray
map a value of true to 1 and a value of false to
0.
Any of the following classes may be passed to the getObject
methods of ResultSet and CallableStatement when
OracleTypes.VECTOR_BINARY is returned by
ResultSetMetaData.getColumnType(int) or
ParameterMetaData.getParameterType(int):
byte[]
boolean[]
String
java.sql.Clob
VECTOR.SparseBooleanArray
Conversions to byte[] pack 8 BINARY dimensions into the bits
of each byte, in MSB order, such that lowest dimension is
stored in the highest bit. The length of the byte[] is the
number of dimensions divided by 8, and then plus 1 if the number of
dimensions is not evenly divisible by 8.
Conversions to boolean[] and SparseBooleanArray
map a value of 0 to false, and a value of 1 to
true.
Conversions to String return the VARCHAR literal expression of
a BINARY VECTOR. This is a sequence of 8-bit unsigned integers, with each
integer storing 8 BINARY values. The integers are separated by a comma and
enclosed in square brackets: [value0,value1,...].
Conversions to Clob return an instance of Clob
which reads the same VARCHAR literal expression that would result from a
conversion to String. The returned Clob is
read-only.
public static OracleType[] values()
for (OracleType c : OracleType.values()) System.out.println(c);
public static OracleType valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static OracleType toOracleType(java.sql.SQLType sqlType) throws java.sql.SQLException
sqlType is an instance of OracleType, this method returns
the sqlType object. If the provided sqlType is an instance
of JDBCType having a
vendor type number equal to
the vendor type number of an OracleType, this method returns that
corresponding OracleType. Otherwise, if no corresponding
OracleType exists for the sqlType, this method throws
a SQLException.sqlType - A SQLType. Not null.java.sql.SQLException - If no OracleType corresponds to sqlTypepublic static OracleType toOracleType(int oracleTypesConst) throws java.sql.SQLException
OracleTypes.oracleTypesConst - an int value defined in OracleTypes.java.sql.SQLException - if there is no corresponding OracleType.public java.lang.String getName()
getName in interface java.sql.SQLTypepublic java.lang.String getVendor()
getVendor in interface java.sql.SQLTypepublic java.lang.Integer getVendorTypeNumber()
getVendorTypeNumber in interface java.sql.SQLTypepublic boolean isNationalCharacterSet()
public boolean isSupported()