Register the opaque data type

To create an opaque data type within a database, you must have the Resource privilege on the database. The CREATE OPAQUE TYPE statement registers an opaque data type with the database. It provides the following information to the database:
  • The name and owner of the opaque data type

    The opaque-type name is the name of the data type that SQL statements use. It does not have to be the name of the internal structure for the opaque data type. You might find it useful to create a special prefix to identify the data type as an opaque data type. The opaque-type name must be unique within the name space.

  • The size of the opaque data type

    You specify this size information with the INTERNALLENGTH modifier. It indicates whether the data type is a fixed-length or varying-length opaque data type. For more information, see Create the internal structure in C.

  • The values of the different opaque-type modifiers

    The CREATE OPAQUE TYPE statement can specify the following modifiers for an opaque data type: MAXLEN, PASSEDBYVALUE, CANNOTHASH, and ALIGNMENT. You determine this information when you create the internal structure for the opaque data type. For more information, see Create the internal structure in C.

The CREATE OPAQUE TYPE statement stores this information in the sysxtdtypes system catalog table. When it stores a new opaque data type in sysxtdtypes, the CREATE OPAQUE TYPE statement causes a unique value, called an extended identifier, to be assigned to the opaque data type. Throughout the system catalog, an opaque data type is identified by its extended identifier, not by its name. (For more information about the columns of the sysxtdtypes system catalog, see the chapter on system catalog tables in the HCL OneDB™ Guide to SQL: Reference.)

To register a new opaque data type in a database, you must have the Resource privilege on that database. By default, a new opaque data type has Usage permission assigned to the owner. For information about how to change the permission of an opaque data type, see Grant privileges for an opaque data type.

For more information about the syntax of the CREATE OPAQUE TYPE, CREATE FUNCTION, and CREATE FUNCTION FROM statements, see their descriptions in the HCL OneDB Guide to SQL: Syntax.