Example: Assignments involving UDTs

Suppose you want to store the form filled out by a new applicant into the database.

You have defined a host variable containing the character string value used to represent the filled form:

     EXEC SQL BEGIN DECLARE SECTION; 
       SQL TYPE IS CLOB(32K) hv_form; 
     EXEC SQL END DECLARE SECTION; 
  
     /* Code to fill hv_form */ 
  
     INSERT INTO APPLICATIONS 
       VALUES (134523, 'Peter Holland', CURRENT DATE, :hv_form) 

You do not explicitly invoke the cast function to convert the character string to the UDT personal.application_form. This is because DB2® allows you to assign instances of the source type of a UDT to targets having that UDT.

Related reference
Example: Assignments in dynamic SQL