Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone know if the UNION operator is supported by DB2/MVS v6.1?

Status
Not open for further replies.

sctek

Programmer
Mar 26, 2003
2
US
I'm using the union operator to insert rows into a record, not for creating a view. Wondering if this is supported by DB2/MVS v6.1. If not, do you know of any alternatives?
Thanks!
 
If you are trying to:

INSERT INTO table1
SELECT *
FROM Table2
UNION
SELECT *
FROM table3

Then I'm pretty certain that you can't do it. If this is what you are trying to achieve then you can obviously do it using two inserts.
hth
Marc
 
Well... it's not really the same as two inserts because the UNION will insert distinct rows.
 
How about simulating a UNION using FULL OUTER JOIN..

INSERT INTO table1
  SELECT value(table2.field1,table3.field2),
value(table2.field2,table3.field2), etc...
  FROM Table2 FULL JOIN table3 on <all fields>

Won't this work? I'm not sure about the performance implication if this type of join.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top