The opaque type
When you declare a fixed binary host variable, you must
specify the opaque type as a quoted string.
Important: Both
the quotation mark (') and the double quotation mark (") are valid
quote characters. However, the beginning quote and ending quote characters
must match.
The opaque type name is optional; it affects the declaration as
follows:
- When you omit opaque type from the fixed binary declaration,
the database server attempts to identify the appropriate support functions
to use when it sends the host variable to the database server for
storage in the opaque-type column.
You can use the fixed binary host variable to hold data for several different opaque types (as long as the database server is able to find the appropriate support functions).
- When you specify opaque type in the fixed binary declaration,
the database server knows precisely which support functions to use
to read and write to the opaque-type column.
Using opaque type can make data conversion more efficient. In this case, however, the fixed binary host variable can hold data only for the specified opaque type data type.
You can declare several fixed binary variables in a single
declaration. However, all variables must have the same opaque type,
as the following declaration shows:
#include <shape.h>;
EXEC SQL BEGIN DECLARE SECTION;
fixed binary 'shape' shape_t square1, square2;
EXEC SQL END DECLARE SECTION;