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

  • Home
  • SEARCH
  • 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 8591853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:37:01+00:00 2026-06-11T23:37:01+00:00

I am trying to do something such as: for(int i = 0; i<10; i++)

  • 0

I am trying to do something such as:

for(int i = 0; i<10; i++)
{
    for(int j = 0; j<10; j++)
    {
        Blah;
    }
}

//As you can see each time that there is a different i, j starts at 0 again.

Using cursors in Oracle. But if I’m correct, after I fetch all rows from a cursor, it will not restart. Is there a way to do this?

Here is my sql:

CREATE OR REPLACE PROCEDURE SSACHDEV.SyncTeleappWithClientinfo
as
teleCase NUMBER;

CURSOR TeleAppCursor
is
    Select 
        distinct(casenbr)
    from TeleApp;


CURSOR ClientInfoCursor
is
    Select casenbr 
    from clientinfo 
    where trim(cashwithappyn) is null;

BEGIN

    open TeleAppCursor;
    open ClientInfoCursor;

    LOOP
        fetch TeleAppCursor into teleCase;
        EXIT when TeleAppCursor%NOTFOUND;

        LOOP
            fetch ClientInfoCursor into clientCase;
            EXIT when ClientInfoCursor%NOTFOUND;
                if clientCase = teleCase then

                    update ClientInfo 
                    set cashwithappyn = (select cashwithappyn from teleapp where casenbr = clientCase) 
                    where casenbr = clientCase;

                    break;
                end if;
        END LOOP;
    END LOOP;

END;

I did check online and was unable to find anything on this.

  • 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-11T23:37:02+00:00Added an answer on June 11, 2026 at 11:37 pm

    You don’t need the second cursor at all, just use the set operations in Oracle to update the appropriate records without manually searching for them yourself:

    DECLARE
        v_teleCase      TeleApp.teleCase%TYPE;
        v_cashwithappyn TeleApp.cashwithappyn%TYPE
    
        CURSOR TeleAppCursor
        is
            Select 
                distinct casenbr, cashwithappyn
            from TeleApp;
    
    BEGIN
    
        open TeleAppCursor;
    
        LOOP
            fetch TeleAppCursor into v_teleCase, v_cashwithappyn;
            EXIT when TeleAppCursor%NOTFOUND;
    
            UPDATE ClientInfo
            SET cashwithappyn = v_cashwithappyn
            WHERE casenbr = v_teleCase
            AND trim(cashwithappyn) is null;
    
        END LOOP;
    
    END;
    

    It’s also a good idea to not have variables with the same name as columns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to multithread something and i have my program set up such that
I'm trying something new and trying to run before I can crawl. I'm using
Is it possible to set for(AssociatedControlID) attribute using jQuery? I am trying something like
I have been trying to compile netcat.c on AIX for some time (using the
I am trying to so something like Database Design for Tagging , except each
I am trying to perform a query using Linq, something I am new to.
I am trying to implement something that requires a structure like this: struct abc
I am trying to do something very similar to that previous question but I
I'm trying to do something I'm not sure LINQ can do -but let's try!
I'm trying something very simple. Upon page load the data in content div is

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.