Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8556385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:20:16+00:00 2026-06-11T15:20:16+00:00

This is what I am trying to achieve: define a cursor which return me

  • 0

This is what I am trying to achieve:

  1. define a cursor

  2. which return me list of rows

  3. use the rows to do some modify tables

  4. repeat 2 and 3 until cursor returns no result.

this is what I have done so far

DECLARE
  CURSOR c1 IS
    [My SQL HERE];

BEGIN

   FOR r1 in c1 LOOP
   [modify tables]

END; 

question is where do I put the while? I would do it before the for loop. but whats the syntax in pl/sql to describe c1 has result?

Note after c1 fullly finish I need to rerun the cursor code. Make another iteration . Because the result will be different. That’s why I needed the while

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:20:17+00:00Added an answer on June 11, 2026 at 3:20 pm

    The answer is combine ‘while’ with ‘for ‘. Obviously only if you want to run the cursor multiple times, because you are update/alter something inside the cursor, and the condition changed, thus you need to re-run the cursor again.

    here is the basic structure:

     DECLARE
      CURSOR c1 IS
        [My SQL HERE];
    
    BEGIN
    
       WHILE CONDITION LOOP
    
       FOR r1 in c1 LOOP
       [modify tables]
       END LOOP; -- for loop
    
       [Check The Condition]
    
       END LOOP; -- while loop
    
     END; 
    

    e.g

      DECLARE
    
      counts NUMBER := -1;
      CURSOR c1 IS
        [Statement Here];
    
    BEGIN
    
       WHILE count != 0 LOOP
    
       FOR r1 in c1 LOOP
       [modify tables]
       END LOOP; -- for loop
    
       SELECT count(*) ...... INTO counts
    
       END LOOP; -- while loop
    
    END; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to achieve something like this. The Expandable List consists of the
This is what I am trying to achieve: if a property is set then
I'm trying to achieve what this guy here is doing, only in PHP or
I am trying to achieve this effect where a photo gets a repeating pattern
I'm trying to achieve URLs like this in Rails: http://localhost/posts/1234/post-slug-name with both ID and
I am trying to achieve this using Expression Blend 3. I need that every
this is the scenario i'm trying to achieve: a sound stored on the same
I'm trying to achieve something similar to jQuery Glow or this fiddle . Specifically
I am trying to achieve exactly something like this - a text view on
What I am trying to achieve is something like this: class object: def __init__(self):

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.