Struct
This section describes the differences between Oracle Database and GaussDB when the JDBC driver of the java.sql.Struct type is used.

- GaussDB currently does not support the constructors not listed in the aforementioned table.
- If the attribute type is a character type and the length of the construction input string exceeds that defined by the element type, Oracle Database reports an error during input parameter binding.
GaussDB does not verify type modifiers when constructing or binding input parameters. When a database receives struct objects and executes SQL statements, it decides whether to report an error.
- If the number of array elements exceeds the actual number of columns of the corresponding type, an error is reported during creation.
When the number of array elements is less than the actual number of columns, the creation of Oracle Database is successful, but an error is reported during parameter input for execution; GaussDB reports an error during creation.
Method |
Return Value Type |
Throws |
GaussDB |
---|---|---|---|
getSQLTypeName() |
String |
SQLException |
Supported. |
getAttributes() |
Object[] |
SQLException |
Supported. |
getAttributes(java.util.Map<String,Class<?>> map) |
Object[] |
SQLException |
Not supported. |

The differences in the getSQLTypeName API are as follows:
- For the package type, the struct constructed in the packageName.typeName format, the differences in the getSQLTypeName API are as follows:
- OJDBC11 returns packageName.typeName.
- OJDBC8 generally returns packageName.typeName, or returns "packageName"."typeName" when packageName and typeName meet the following condition:
Any of packageName or typeName does not meet the rule of starting with a letter followed by characters including letters, digits, or underscores.
- GaussDB generally returns schemaName.packageName.typeName, or returns "schemaName"."packageName"."typeName" when schemaName, packageName, and typeName meet the following condition:
Any of schemaName, packageName, or typeName does not meet the rule of starting with a letter or underscore followed by characters including letters, digits, or underscores.
- For the package type, the differences in the getSQLTypeName API in other scenarios are as follows:
- OJDBC11 returns schemaName.packageName.typeName.
- OJDBC8 generally returns schemaName.packageName.typeName, or returns "schemaName"."packageName.typeName" when schemaName, packageName, and typeName meet the following condition:
Any of schemaName, packageName, or typeName does not meet the rule of starting with a letter followed by characters including letters, digits, or underscores.
- GaussDB generally returns schemaName.packageName.typeName, or returns "schemaName"."packageName"."typeName" when schemaName, packageName, and typeName meet the following condition:
Any of schemaName, packageName, or typeName does not meet the rule of starting with a letter or underscore followed by characters including letters, digits, or underscores.
- For the non-package type, the differences in the getSQLTypeName API are as follows:
- OJDBC11 returns schemaName.typeName.
- OJDBC8 generally returns schemaName.typeName, or returns "schemaName"."typeName" when schemaName and typeName meet the following condition:
Any of schemaName or typeName does not meet the rule of starting with a letter followed by characters including letters, digits, or underscores.
- GaussDB generally returns schemaName.typeName, or returns "schemaName"."typeName" when schemaName and typeName meet the following condition:
Any of schemaName or typeName does not meet the rule of starting with a letter or underscore followed by characters including letters, digits, or underscores.
Database Attribute Type |
Java Type of the Corresponding Element in the Return Value (Oracle Database OJDBC8) |
Java Type of the Corresponding Element in the Return Value (Oracle Database OJDBC11) |
Java Type of the Corresponding Element in the Return Value (GaussDB) |
---|---|---|---|
CHAR |
String |
String |
String |
VARCHAR/VARCHAR2 |
String |
String |
String |
NCHAR |
String |
String |
String |
NVARCHAR2 |
String |
String |
String |
NUMBER |
BigDecimal |
BigDecimal |
BigDecimal |
NUMERIC |
BigDecimal |
BigDecimal |
BigDecimal |
DECIMAL |
BigDecimal |
BigDecimal |
BigDecimal |
INTEGER |
BigDecimal |
BigDecimal |
Integer |
SMALLINT |
BigDecimal |
BigDecimal |
Short |
DOUBLE PRECISION |
BigDecimal |
BigDecimal |
Double |
FLOAT |
BigDecimal |
BigDecimal |
Double |
REAL |
BigDecimal |
BigDecimal |
Float |
BINARY_DOUBLE |
Double |
Double |
Double |
BINARY_INTEGER |
BigDecimal |
Integer |
Integer |
BOOLEAN |
BigDecimal |
Integer |
Boolean |
TIMESTAMP |
Timestamp |
Timestamp |
Timestamp |
TIMESTAMP WITH TIME ZONE |
TIMESTAMPTZ |
TIMESTAMPTZ |
Timestamp |
BLOB |
BLOB |
BLOB |
PGBlob |
CLOB |
CLOB |
CLOB |
PGClob |
Set/Array |
ARRAY |
ARRAY |
GaussArray |
RECORD |
STRUCT |
STRUCT |
GaussStruct |

GaussDB currently does not support the types unlisted in the aforementioned table.

- When a struct is constructed, if the Java type of the input element does not match the target type, an implicit conversion operation is performed. For details on the Java types of input elements supported by various database element types, refer to the preceding table.
- GaussDB currently does not support the types unlisted in the aforementioned table.
- The constructor needs to provide an attribute array. The preceding table describes the differences of each attribute in the array.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot