Example: Use of UDTs in UNION

Suppose you want to provide your U.S. users with a query to show all the sales of every product of your company.

The SELECT statement is as follows:
       SELECT PRODUCT_ITEM, MONTH, YEAR, TOTAL 
       FROM US_SALES 
       UNION 
       SELECT PRODUCT_ITEM, MONTH, YEAR, US_DOLLAR (TOTAL) 
       FROM CANADIAN_SALES 
       UNION 
       SELECT PRODUCT_ITEM, MONTH, YEAR, US_DOLLAR (TOTAL) 
       FROM GERMAN_SALES

You cast Canadian dollars to U.S. dollars and Euros to U.S. dollars because UDTs are union compatible only with the same UDT. You must use the functional notation to cast between UDTs since the cast specification only allows you to cast between UDTs and their source types.