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!

Store multiple values into a variable

655717Dec 23 2009 — edited Dec 24 2009
I was wondering if it was possible to store multiple values into one varaible. Something along the lines of...

Oracle: 10g
--Table xSample (this is obviously a dumbed down version of the table for the sake of showing what I want to accomplish

S_ID   YEAR
1         2009
2         2009
3         2009
4         2009


--Query 

select     s_id
into       pID
from      xSample
where    year = 2009;
Basically the reason I was trying to figure out how to store multiple values into a variable is b/c I was going to use that variable (pID) as a parameter and have it's values passed dynamically when the proc was called. The values would go into a query that would look something like:
select *
from cust_data
where person_id in (pID)

aka 

select *
from cust_data
where person_id in (1,2,3,4)
Not sure if this is possible, but if anyone knows of a way I could accomplish this that would be great.

Edited by: user652714 on Dec 23, 2009 9:37 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 21 2010
Added on Dec 23 2009
7 comments
4,774 views