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!

How to create a lookup table from a subquery in a plsql block.

807684Mar 30 2011 — edited Mar 30 2011
Hi,

I need help on a basic question in PLSQL.

I have a subquery which returns values of a column in a table, I use this subquery in WHERE condition with IN clause in a stored procedure..

I have multiple where conditions which needs the same subquery, Is there a way to store the records retruned by the subquery in a lookup table and check if the column value is present in the lookup table insted of doing it like the below example..

Ex
select 1 from table1
where col1 IN (subquey)
AND col2 IN (subquery)
AND col3 IN (subquery)
...
...
...;

if this is a very basic question, please give me a pointer, I will look up for more info, I was actually trying if I can get the subquery data in a collection like Associative Arrays, but was unable to lookup for the data in the collections..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2011
Added on Mar 30 2011
2 comments
799 views