Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Help! Using Variable String as Argument in "where in" clause
Hi!
Is the select statement created as a cursor. If not, then I think you are missing an "into" statement in your select. And then your result can only contain one value.
If your declare as a cursor your can pass variables to the cursor. here is an example:
cursor cur_pmix(bus_date varchar2) is
select
sto.store_number, sto.store_name, prod.product_mix_group_code, sum(stowk.units_sold) units_sold from stores sto, menu_items men, product_mix_groups prod, store_mix_wk stowk where stowk.business_date=to_date(bus_date, 'dd-mm-yyyy') and stowk.menu_code=men.menu_code and stowk.store_id=sto.store_id and prod.product_mix_group_code<>24 and prod.product_mix_group_code=men.product_mix_group_code and sto.store_id=stowk.store_id group by sto.store_number, sto.store_name, prod.product_mix_group_code;
In this example i can pass a date to the cursor like this:
for temp in cur_pmix('08-03-1998') loop
..
..
end loop;
The date could be a string variable.
I hope this will help you, else write me.
--
Casper Thrane
InfoAccess
Received on Thu May 21 1998 - 13:46:19 CDT
![]() |
![]() |