Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Help! Using Variable String as Argument in "where in" clause

Re: PL/SQL Help! Using Variable String as Argument in "where in" clause

From: Casper Thrane <ct_at_infoaccess.dk>
Date: Thu, 21 May 1998 20:46:19 +0200
Message-ID: <3564767B.77C11850@infoaccess.dk>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US