Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Repost: Nested loop in PL/SQL
Jun the corrected code should be ... assuming you want to process channel_id
for each row of pla_id.
declare v_plan_id number; v_channel_id pricing_plan.channel_id%TYPE; v_row pricing_plan%ROWTYPE;
where CHANNEL_ID = 'GROUP19' and promotion_cd = 'INFO' and trunc(end_date) >= trunc(sysdate)
cursor channel_id is
select distinct channel_id from pricing_plan
where CHANNEL_ID not in ('GROUP1','GROUP2', 'GROUP3')
and transaction_type = 'REGISTRATION'
order by channel_id;
begin
open plan_id;
loop
fetch plan_id into v_plan_id;
exit when plan_id%NOTFOUND;
open channel_id; <<------ note this line
loop
fetch channel_id into v_channel_id;
exit when channel_id%NOTFOUND;
select * into v_row from pricing_plan where PRICING_PLAN_ID = 1;
dbms_output.put_line(v_row.price_cd);
end loop;
close channel_id; <<------ note this line
end loop;
close plan_id;
end;
/
QOTD: Any clod can have facts, but having an opinion is an art !
*********************************************************************1
This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.
*********************************************************************1
Received on Tue Oct 02 2001 - 13:17:09 CDT
![]() |
![]() |