oracle - With clause not working with union -


my query result union of several queries. facing below error when use clause within union. ideas why?

select column1 table_a union abcd (select * table_b)     select column2 table_a a, abcd      abcd.m_reference = a.m_reference 

ora-32034: unsupported use of clause
32034. 00000 - "unsupported use of clause"
*cause: inproper use of clause because 1 of following 2 reasons
1. nesting of clause within clause not supported yet
2. set query, clause can't specified branch.
3. clause can't sepecified within parentheses.
*action: correct query , retry

just define cte first, before actual union query. use regular table:

with abcd (select * table_b) select column1 table_a union select column2 table_a inner join abcd     on abcd.m_reference = a.m_reference 

you can use multiple cte follows:

with cte1 (...),      cte2 (...) select * ... 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -