Previous Topic: Additional Items to ConsiderNext Topic: Additional Considerations


Default Values for Redefinitions and Arrays

As with any INSERT, when performing an INSERT into a DATACOM VIEW, every base-table column must receive an explicitly-specified value, a default, or a NULL. SQL processes any default values defined for a redefined column.

Note: d The default value for an array column, when referenced through a DATACOM VIEW, is considered to be an array-element value and is applied separately to each array element not receiving a value.

These defaults are added through CA Datacom Datadictionary rather than through SQL DDL.

With redefines involved, SQL must decide which default to apply to a given base-table column. Therefore, when processing an INSERT, the following algorithm is applied (columns that are not part of any redefinition are referred to as primary columns):

  1. The INSERT statement is compared to the definition of the base-table in order to determine whether a value has been supplied for every primary column. If every primary column has a value, the INSERT procedure goes forward. Otherwise, step 2 occurs.
  2. For each primary column not receiving a value, CA Datacom/DB:
    1. Lays down any non-NULL default defined for that column.
    2. Overlays this with defaults or NULL for all redefinitions that are both a part of the DATACOM VIEW, and intersect the primary column.
    3. If neither the laying down nor overlaying in the previous two steps resulted in a non-NULL value being placed in any portion of the primary column, a NULL is inserted. Null indicators for intersecting redefines remain in place.