For Loop in SQL Developer PL/SQL

I have the following code...Im trying to mimic how a .NET program is running their logic in SQL Developer
SO I have a loop with a Select statement and the next line of code is a call to a procedure that does another Select statement in a loop so my question is...

 for i in(Select * from INSURED_ENTITY where CVG_ID= l_Temp_COV_cvg_ID AND POLNBR= l_Temp_COV_polNbr AND COV_EFFDT = l_Temp_COV_covEffDate ORDER BY COV_NAME_SEQ ASC) loop        
                 
                    For j in(Select   * from ENDORSE Where NAME_OF_CLIENT = i.NAME) LOOP
                                         
                    end loop;
                                 
end loop;

How do I iterate through these for loops? If I wanted to do a Next I or a Next j how could I do that? Is there a list of properties or methods that I can check? Like how do I check for end of the data set? I know I can access the I loop fields like i.NAME but what are my other options with the for loop for i? Can I check rowcount or anything?

Thanks
jknj72Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
The 'next' is implied.  No need to code it.  No need to check for end.  etc...

From your previous question, there is a CONTINUE if you want to stop an iteration before it naturally ends:
drop table tab1 purge;
create table tab1(col1 char(1));
insert into tab1 values('a');
insert into tab1 values('b');
commit;

begin
	for i in (select col1 from tab1) loop
		if i.col1 = 'a' then
			continue;
		end if;
		dbms_output.put_line('Here with ' || i.col1);

	end loop;
end;
/

Open in new window


I would start in the online docs for cursor loops:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/cursor_for_loop_statement.htm#LNPLS1155

>>Can I check rowcount or anything?

Keep a counter in code and increment it inside the loop?  I don't think there is a variable built in that you can access.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sdstuberCommented:
>>> How do I iterate through these for loops?
            The  loop structure does that for you


>>> If I wanted to do a Next I or a Next j how could I do that?
      use CONTINUE key word to skip the rest of the loop and jump to the next element in the cursor
       you do NOT need to increment a counter or pointer yourself, the cursor-for loop structure does that for you


>>> Is there a list of properties or methods that I can check?
     no

>>> Like how do I check for end of the data set?
    you don't need to,  cursor for loops walk to the end of the cursor and exit on their own

>>>> I know I can access the I loop fields like i.NAME but what are my other options with the for loop for i?
    none

>>> Can I check rowcount or anything?
     not with a cursor for loop, but you could either include a count(*) call in the result set, or increment your own counter inside the loop
Mark GeerlingsDatabase AdministratorCommented:
"trying to mimic how a .NET program [gets the job done]" may or may not be the best way to solve a problem in PL\SQL.

Can you describe the business problem the .NET program was written to solve, and allow us to recommend the best way to solve that problem in PL\SQL?
jknj72Author Commented:
thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.