%SUBREC meta-SQL element

Syntax

%SUBREC(subrec_name, corel_name)

Description

%SUBREC is used only in dynamic view SQL, where it expands to the columns of a subrecord. You can't use this statement in SQLExec or any other SQL statement.

Note:

%SUBREC must be either all uppercase or all lowercase.

Parameters

Parameter Description

subrec_name

Specify the name of the subrecord.

corel_name

Specify the correlation name.

Example

Suppose you have a record definition AAA_VW that is a dynamic view, with fields CHR, SUB, and NUM. The field SUB is a subrecord with fields CHR_SUB, NUM_SUB, and IMG_SUB. The view text for AAA_VW could be:

"select a.chr, %subrec(sub,a), a.num from ps_aaa a"

The Create View SQL generated by this view text would be:

"CREATE VIEW SYSADM.PS_AAA_VW (CHR, CHR_SUB, NUM_SUB, IMG_SUB, NUM) AS SELECT⇒
 A.CHR, A.CHR_SUB, A.NUM_SUB, A.IMG_SUB, A.NUM FROM PS_AAA A"