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!

With alias in another with?

Marco SilvaAug 18 2015 — edited Aug 19 2015

Hey guys, can someone help me?

I need to run an extremely heavy Query and use its results in another Query. For this, I am putting it in a subquery using the clause "with". But I also need to use this result in another subquery "with". How can I do this without losing performance?


Example:


With dummy as (select id, count(*) as qtd from dual group by id),

        dummy_dummy as (select dual.id, count(dummy.*) as qtd from dual, dummy where dual.id = dummy.id group by dual.id)

select dummy.qtd, dummy_dummy.qtd

from dummy, dummy_dummy

where dummy.id = dummy_dummy.id(+)


Thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2015
Added on Aug 18 2015
4 comments
315 views