Dynamic Cursor is not fetching to the next record value

Hi All


I have used dynamic cursors in my code. I also have used elseif ladder to avoid following error.

The program attempted to execute an OPEN statement for an open cursor.

I could be able to resolve the above error with elseif ladder but the following statement in my code is not fetching any new record
into V_WC8PAY_ID when i checked in line by line debugging.

fetch c10 into V_WC8PAY_ID;

I could not understand why dynamic cursor c10 is not working.

Please guide me.
Prardhan NAsked:
Who is Participating?

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

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.

Kent OlsenDBACommented:
Hi sridhar,

Some mostly minor things....

- It looks like cursor c10 isn't being closed after you loop through the data for the firs value of V_PPCPAYINST_ID.
- You can use a single EOF flag to manage your loops.
- The test for FLAG around the opening of cursor C4 is unnecessary.

I've removed all of the commented code (so it was easier for me to read) and made the changes noted above.  See attachment.


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
Prardhan NAuthor Commented:
Thanks for your kind help.
Appreciating your help.
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

From novice to tech pro — start learning today.