Handling a nonsimple state
When the data type of the aggregate argument is not adequate for the state information, you must use a nonsimple state for your UDA. A nonsimple state is an aggregate state whose data type is not the same as the aggregate argument.
Possible uses for a nonsimple state include an aggregate state
that contains:
- An aggregate state that contains more information than the aggregate-argument data type can hold
- An aggregate state that contains information of a data type different than that of the aggregate argument
When the aggregate-argument data type is not adequate for the state
information, you must determine the appropriate data structure to
hold the state information. This data structure depends upon the size
of the aggregate state that you need to maintain, as the following
table shows.
Nonsimple state | Description | More information |
---|---|---|
Single-valued state | Consists of information that can be stored in HCL Informix® built-in data types | Using a single-valued state for a UDA |
Opaque-type state | Consists of several values, but these values do not exceed the maximum size of an opaque data type | Manage an opaque-type state. |
Pointer-valued state | Consists of values whose size does exceed the maximum size of an opaque data type | Using a pointer-valued state for a UDA. |
If your user-defined aggregate uses a single-valued or opaque-type state, the database server can still perform the state management. However, it cannot provide all necessary state management for a pointer-valued state.