Was this helpful?
Use of Host Language Variables in a Union
When SELECT statements are combined using the UNION clause, the INTO clause must appear only after the first list of select result expressions, because all result rows of the SELECT statements that are combined by the UNION clause must be identical. The following example shows the correct use of host language variables in a union; result variables are specified only for the first SELECT statement:
EXEC SQL SELECT ename, enumber
              INTO :name, :number
              FROM employee
       UNION
       SELECT dname, dnumber
              FROM directors
              WHERE dnumber < 100;
Last modified date: 08/28/2024