Performing assignments involving distinct types in embedded SQL

This section provides information about performing assignments involving distinct types in embedded SQL.

About this task

Suppose you want to store the job application form completed by a new applicant into the database. You can define a host variable containing the character string value used to represent the completed 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 host variable to the distinct type personal.application_form because Db2® lets you assign instances of the source type of a distinct type to targets having that distinct type.