company logo

Select expression

Keywords:  select method

The select operation defines the rules for calculating the derived values. The SELECT operation allows defining an implicit defined complex data type. Each operand in the operand (or attribute) list defines an property in the result data type. The SELECT allows defining any number of attributes or collection properties by defining the data type, the property name and an assignment expression defining the value for the property.

The source for a SELECT operation (calling object) in an access path is the result of the preceding operand. In a SELECT statement, the calling object is the result of the FROM operation when no grouping has been defined or the result of the GROUP BY operation otherwise. All expressions for assigning values to SELECT operands must be valid in the context of the data type of the calling object.

When an operand is a result of an operation, an operand name and data type definition have to be defined explicitly. One may omit the type definition, when the operation is defined as OSI function in the resource data base or as preloaded OSI function, which provides the type in the return value definition. The type is required, when the function is implemented as C++ function supported via OSI interface.

The operand list may contain an '*' only, which does nothing else than returning the instances as being defined in the source operand (calling object or FROM operation) for the SELECT operation. This operation does not make sense in an access path. When a SELECT statement contains a GROUP operation, the result contains all grouping attributes, but not the partition property.

Usually, the select operands may refer to grouping attributes, aggregation functions and transient attributes.

SELECT ( sex, // attribute reference

         string age = age_group, // attribute definition

         int cnt = sum(1) // named operation

         int(10,2) avr_inc = average(income) )

Definition: 

sel_spec := _select operand_list

Grouping attributes

In order to become part of result instances, grouping attributes have to be defined explicitly in the SELECT operand (or VIEW attributes) list. One may also define operations based on grouping attributes for defining derived result attributes, but this is usually solved more comfortable by transient properties.

- Title unknown
Transient properties

Transient properties are evaluated by an assigned operands or by means of context functions (read event handler). Operands assigned to transient properties in a VIEW definition or SELECT statement must be valid in the context of the VIEW or SELECT result data type. Transient attributes with assigned operands are evaluated when accessing transient attributes, i.e. after aggregations have been completed.

Related topics