Access the external format of an opaque type
Use the lvarchar data type for operations on an opaque-type column that has an external representation of a character string.
To use the external format of an opaque type in an SQL statement,
the opaque data type must have input and output support functions
defined. When the client application uses an lvarchar host
variable to transfer data to or from an opaque-type column, the database
server invokes the following support functions of the opaque data
type:
- The input support function describes how to transfer the opaque-type
data from the lvarchar host variable into the opaque-type column.
The database server invokes the input support function for operations such as INSERT and UPDATE statements that send the external format of an opaque type to the database server.
- The output support function describes how to transfer the opaque-type
data from the opaque-type column to the lvarchar host variable.
The database server invokes the output support function for operations such as SELECT and FETCH statements that send the external format of an opaque type to the client application.
Important: If the CREATE OPAQUE TYPE statement specifies
a maxlength limit, that value is the maximum length the database server
stores for the column, regardless of the size of the data sent by
the client application. If the length of the data is more than the
maxlength limit, the database server truncates the data and notifies
the application.
Follow these steps to transfer the external format of an opaque-type
column between the database server and the application:
- Declare an lvarchar host variable
- Use the lvarchar host variable in an SQL statement to perform any select, insert, update or delete operations on the external format of the opaque-type column.