ingres - UNION clause in embedded SQL -
i'm using ingres 10s sql, , i'm trying write following sql statement in embedded sql c program. works fine standalone sql script, compiling esql program gets error
%% error in file localtask.sc, line 498: e_eq0244 syntax error on 'union'.
insert nr301_tab2 (authority_id) select a.authority_id nrremdets a, nrstatus_hierarchy z a.authority_id = z.authority_id union select a.authority_id nrsumsamts a, nrsumsdets b a.authority_id = b.authority_id;
(line 498 union
line) what's wrong union
clause?
just slight tweak of query , should work. try this:
insert nr301_tab2 (authority_id) select authority_id (select a.authority_id nrremdets a, nrstatus_hierarchy z a.authority_id = z.authority_id union select a.authority_id nrsumsamts a, nrsumsdets b a.authority_id = b.authority_id) result
the idea union result sets, create new result set inserted once in table. adding parenthesis make sure happens.
Comments
Post a Comment