troubleshooting Question

Want to use one of two cursors in same for loop

Avatar of BILL Carlisle
BILL CarlisleFlag for United States of America asked on
Oracle Database
7 Comments1 Solution407 ViewsLast Modified:
Hi,
I want to use one of two cursors in same for loop as follows but my syntax is off

declare
   d number:=2;
   rec_type
begin
if(d=3)then
    cursor xyz is
       select 'g' col1,'h' col2,'j' col3,'k' col4 from dual;
else
    cursor xyz is
       select '2g' col1,'2h' col2,'2j' col3,'2k' col4 from dual;
end if;

for rec in xyz loop
   htp.p(rec.col1||' -- '||rec.col2||' -- '||rec.col3||' -- '||rec.col4 );

end loop;
end;
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros