Posted in 1997
Kurt Van Wagoner wrote:
>
> How do you do a select into variable with a union?
> i.e.
> I know
> select id, desc
> into var1, var2
> from tab1> But I do not know;
> select id, desc
> from tab1
> union
> select id2, desc2
> from tab2;>
> Any help would be appreciated.
1) declare a cursor
DECLARE union_curs CURSOR FOR "select .... union select ..."
OPEN union_curs
FETCH union_curs INTO var1, var2 .. varn
regards
Claus Samuelsen
We use strictly necessary cookies to make this site work. With your consent we’d also use optional cookies for analytics and marketing. You can accept all, reject all, or choose. Read our Cookie Policy.