Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Scope of Alias for Subquery in FROM-Clause

387900Feb 17 2003 — edited Feb 18 2003
Hi guys,

I need an SQL construct like this


SELECT ...
FROM x, (subquery) alias
WHERE ...
UNION ALL
SELECT ...
FROM y, (subquery) alias
WHERE ...
UNION ALL
SELECT ...
FROM z, (subquery) alias
WHERE ...

The FROM-Subquery is always the same and it is pretty complex, so I would prefer to define it only once and use only the alias afterwards, like this:

SELECT ...
FROM x, (subquery) alias
WHERE ...
UNION ALL
SELECT ...
FROM y, alias
WHERE ...
UNION ALL
SELECT ...
FROM z, alias
WHERE ...

This results in an error. Any hints?

Thanks,
Akos


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2003
Added on Feb 17 2003
9 comments
2,115 views