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 7490639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:41:29+00:00 2026-05-29T15:41:29+00:00

I was just wondering when it is practical to use a nested or inner

  • 0

I was just wondering when it is practical to use a nested or inner explicit cursor in PL/SQL. Can the situation always be avoided using JOINS?
Any examples of Inner Cursors being used in a practical way would be great!
Thank you in advance.

  • 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-05-29T15:41:31+00:00Added an answer on May 29, 2026 at 3:41 pm

    If you are talking about constructs like

    FOR outer IN (<<query A>>)
    LOOP
      FOR inner IN (<<query B that depends on data from the outer query>>)
      LOOP
        <<do something>>
      END LOOP;
    END LOOP;
    

    It will essentially (i.e. barring some corner case where the optimizer picks a bad plan and it’s not practical to fix that any other way) always be more efficient to combine the two queries and do a join. The SQL engine has far more flexibility to figure out how to join two tables (or two queries) and is much better at it than code you write in the PL/SQL engine.

    That said, if you’re dealing with small volumes of data and you (or the other developers that are maintaining the system) would have trouble following a combined query, there may be valid reasons from a maintainability perspective to code loops like this. It’s likely to be an approach that developers coming from other languages are going to be more comfortable with reading, for example. If the data volumes are small, the additional overhead of manually coding a nested loop join is generally going to be relatively small and can still yield code that performs acceptably.

    Personally, I’d try to avoid this sort of construct if at all possible, but I tend to work with systems that are processing large amounts of data and with people that are comfortable writing proper PL/SQL and proper SQL so queries with joins are going to be more readable. On the other hand, if you’re doing a one-off update of a small table, it may be quicker and easier to write a quick block that does this sort of loop and hand that off to someone else to review rather than having to verify that joining two large queries doesn’t do anything unexpected.

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

Sidebar

Related Questions

Just wondering if a .NET app can be compiled down to native machine code
I'm just wondering should I use std::size_t for loops and stuff instead of int
Possible Duplicate: When should I make explicit use of the this pointer? I'm wondering
Just wondering, when should we actually must use private or protected for some methods
Wondering if I should ALWAYS use the respond_to/format.xxx block in ALL of my actions
I'm new to web development and am just wondering about best practices for java
Just wondering what people think is the best practice when implementing an IValueConverter which
Just wondering if the following is considered to be good programming practice or not?
I think this is just a Best Practices question, but I was wondering if
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview

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.