Reuse select query in a procedure in Oracle
Posted
by Jer
on Stack Overflow
See other posts from Stack Overflow
or by Jer
Published on 2010-03-23T16:21:43Z
Indexed on
2010/03/23
16:23 UTC
Read the original article
Hit count: 268
How would I store the result of a select statement so I can reuse the results with an in
clause for other queries? Here's some pseudo code:
declare
ids <type?>;
begin
ids := select id from table_with_ids;
select * from table1 where id in (ids);
select * from table2 where id in (ids);
end;
... or will the optimizer do this for me if I simply put the sub-query in both select statements?
© Stack Overflow or respective owner