14.52 Qualified Expression

Using qualified expressions, you can declare and define a complex value in a compact form where the value is needed.

Qualified expressions appear in:

Syntax

Semantics

qualified_expression

Qualified expressions for RECORD types are allowed in any context where an expression of RECORD type is allowed.

Qualified expressions for associative array types are allowed in any context where an expression of associative array type is allowed.

typemark ( aggregate )

Specifies explicitly the type of the aggregate (qualified items).

typemark

type_name

Qualified expressions use an explicit type indication to provide the type of the qualified item. This explicit indication is known as a typemark.

[identifier . ]identifier

Indicates the type of the qualified item.

aggregate

A qualified expression combines expression elements to create values of a RECORD type, or associative array type.

positional_choice_list

expr [ , ]

Positional association is allowed for qualified expressions of RECORD type.

A positional association may not follow a named association in the same construct (and vice versa).

sequence_iterator_choice

FOR iterator SEQUENCE => expr

The sequence iterator choice association is a positional argument and may be intermixed freely with other positional arguments. All positional arguments must precede any non-positional arguments. Sequence iteration is not allowed for INDEX BY VARCHAR2 arrays.

explicit_choice_list

named_choice_list | indexed_choice_list | basic_iterator_choice | index_iterator_choice

Named choices must use names of fields from the qualifying structure type. Index key values must be compatible with the index type for the qualifying vector type.

named_choice_list

A named choice applies only to structured types

identifier => expr [ , ]

Named association is allowed for qualified expressions of RECORD type.

indexed_choice_list

An index choice applies only to vector types.

expr => expr [ , ]

Indexed choices (key-value pairs) is allowed for qualified expressions of associative array types. Both the key and the value may be expressions.

Using NULL as an index key value is not permitted with associative array type constructs.

basic_iterator_choice

FOR iterator => expr

The basic iterator choice association uses the iterand as an index.

Restrictions:

The PAIRS OF iteration control may not be used with the basic iterator choice association.

index_iterator_choice

FOR iterator INDEX expr => expr

The index iterator choice association provides an index expression along with the value expression.

others_choice

You can use the OTHERS selector in aggregates for record types and aggregates for varrays. The OTHERS choice must be your final choice.

Examples