Extend operators

When you build a UDT, either by extending a built-in data type or by creating an opaque data type, you must provide for the operations that the data type uses. An operation is a task that the database server performs on one or more values.

You can write special-purpose routines that extend the built-in operations of the database. The manual discusses the following specific types of operators in detail:
  • Arithmetic and relational operators

    The database server provides operator symbols (+, -, =, > and so on) and built-in functions such as cos() and abs(). You can extend these operators for extended data types.

    Extend operators and built-in functions discusses general aspects of extending an operation and describes how to extend operator symbols and built-in functions.

  • Casts

    The database server provides casts for the built-in data types. When you use UDTs, you usually need to provide casts.

    Create user-defined casts describes how to create casts. The HCL OneDB™ Database Design and Implementation Guide discusses how to use casts.

  • Aggregates
    An aggregate produces one value that summarizes some aspect of a selected column; for example, the average or the count. You can extend aggregates in two ways:
    • Create a new aggregate, such as an aggregate that provides the sum of the square of each value in the column.
    • Extend an existing aggregate, such as AVG or COUNT, to include data types that you have defined.

    Creating a user-defined aggregate and extending an existing aggregate for extended data types require different techniques. For information about both techniques, refer to Create user-defined aggregates.