Observation: UNION References Same Table

You coded a UNION with the SELECT * statements referencing the same table. Since a UNION always sorts each of its tables, the same table will be sorted more than once. The following example is a UNION of results from the same table.

SELECT * FROM SYSIBM.SYSTABLES 
WHERE type = 'T' 
UNION 
SELECT * FROM SYSIBM.SYSTABLES 
WHERE type = 'V' 

Consider recoding using the OR clause.

SELECT * FROM SYSIBM.SYSTABLES 
WHERE type = 'T' 
OR type = 'V';