Union Example - SQL Union.

Community Help: DB2 Union - Code example using a DB2 sql union

Share your own experience     View front page

The following is a DB2 sql union example. In this example below it shows "union all", but you can use union instead if you wish.

   EXEC SQL
    DECLARE CUR1 CURSOR FOR
     SELECT COL1
           ,COL2
           ,COL3
     FROM TABLE_A
     UNION ALL
     SELECT COL1
           ,COL2
           ,COL3
     FROM TABLE_B
   END-EXEC.