Oracle® Call Interface Programmer's Guide, 10g Release 2 (10.2) Part Number B14250-02 |
|
|
View PDF |
This section describes the Type Interface functions.
Table 20-3 Type Interface Functions
Function/Page | Purpose |
---|---|
|
Adds an attribute to an object type that was constructed earlier with typecode |
|
Begins the construction process for a transient type. The type will be anonymous (no name). |
|
Finishes construction of a type description. Subsequently, only access will be allowed. |
|
Sets built-in type information. This call can be made only if the type has been constructed with a built-in typecode ( |
|
Sets collection type information. This call can be made only if the type has been constructed with a collection typecode. |
Purpose
Adds an attribute to an object type that was constructed earlier with typecode OCI_TYPECODE_OBJECT
.
Syntax
sword OCITypeAddAttr ( OCISvcCtx *svchp, OCIError *errhp, OCIType *type, CONST text *a_name, ub4 a_length, OCIParam *attr_info );
Parameters
The OCI service context.
The OCI error handle. If there is an error, it is recorded in err
and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet()
.
The type description that is being constructed.
Optional. The name of the attribute.
Optional. The length of attribute name, in bytes.
Information on the attribute. It is obtained by allocating an OCIParam
parameter handle and setting type information in the OCIParam
using OCIAttrSet()
calls.
Purpose
Begins the construction process for a transient type. The type will be anonymous (no name).
Syntax
sword OCITypeBeginCreate ( OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, OCIDuration dur, OCIType **type );
Parameters
The OCI Service Context.
The OCI error handle. If there is an error, it is recorded in err
and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet()
.
The typecode for the type. The typecode could correspond to an object type or a built-in type.
Currently, the permissible values for User Defined Types are:
OCI_TYPECODE_OBJECT
for an Object Type (structured),
OCI_TYPECODE_VARRAY
for a VARRAY
collection type or
OCI_TYPECODE_TABLE
for a nested table collection type.
For Object types, call OCITypeAddAttr()
to add each of the attribute types. For Collection types, call OCITypeSetCollection()
. Subsequently, call OCITypeEndCreate()
to finish the creation process.
The permissible values for built-in type codes are specified in "Typecodes". Additional information on built-in types (precision, scale for numbers, character set information for VARCHAR2
s, and so on) if any, must be set with a subsequent call to OCITypeSetBuiltin()
. Finally, you must use OCITypeEndCreate()
to finish the creation process.
The allocation duration for the type. One of the following:
The OCIType
(Type Descriptor) that is being constructed.
Comments
To create a persistent named type, use the SQL statement CREATE
TYPE
. Transient types have no identity. They are pure values.
Purpose
Finishes construction of a type description. Subsequently, only access will be allowed.
Syntax
sword OCITypeEndCreate ( OCISvcCtx *svchp, OCIError *errhp, OCIType *type );
Parameters
The OCI service context.
The OCI error handle. If there is an error, it is recorded in err
and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet()
.
The type description that is being constructed.
Purpose
Sets built-in type information. This call can be made only if the type has been constructed with a built-in typecode (OCI_TYPECODE_NUMBER
, and so on).
Syntax
sword OCITypeSetBuiltin ( OCISvcCtx *svchp, OCIError *errhp, OCIType *type, OCIParam *builtin_info );
Parameters
The OCI service context.
The OCI error handle. If there is an error, it is recorded in err
and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet()
.
The type description that is being constructed.
Provides information on the built-in (precision, scale, character set, and so on). It is obtained by allocating an OCIParam
parameter handle and setting type information in the OCIParam
using OCIAttrSet()
calls.
Purpose
Sets collection type information. This call can be made only if the type has been constructed with a collection typecode.
Syntax
sword OCITypeSetCollection ( OCISvcCtx *svchp, OCIError *errhp, OCIType *type, OCIParam *collelem_info, ub4 coll_count );
Parameters
The OCI service context.
The OCI error handle. If there is an error, it is recorded in err
and this function returns OCI_ERROR
. Obtain diagnostic information by calling OCIErrorGet()
.
The type descriptor that is being constructed.
collelem_info
provides information about the collection element. It is obtained by allocating an OCIParam
parameter handle and setting type information in the OCIParam
using OCIAttrSet()
calls.
The count of elements in the collection. Pass 0 for a nested table (which is unbounded).