Inserting structured type attributes into columns
To insert an attribute of a user-defined structured type into a column that is of the same type as the attribute using embedded static SQL, enclose the host variable that represents the instance of the type in parentheses, and append the double-dot operator and attribute name to the closing parenthesis.
About this task
For example, consider the following situation:
PERSON_T
is a structured type that includes the attributeNAME
of typeVARCHAR(30)
.T1
is a table that includes a columnC1
of typeVARCHAR(30)
.personhv
is the host variable declared for typePERSON_T
in the programming language.
The proper syntax for inserting the NAME attribute into column C1 is:
EXEC SQL INSERT INTO T1 (C1) VALUES ((:personhv)..NAME)