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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:08:26+00:00 2026-05-27T18:08:26+00:00

Hi everyone I am a bit new to PL/SQL so am a bit confused.

  • 0

Hi everyone I am a bit new to PL/SQL so am a bit confused. I have a Cursor called rec and while looping through it I have two nested IF statements.

CURSOR Cur IS
    SELECT Mil.Id,
           Mil.Record_Num,
           Mil.Status,
           Mil.file_processed,
           Mil.Updated_By
      FROM status_log mil
     WHERE Mil.file_processed != 'Processed'
     For Update of Mil.file_processed;

 FOR Rec IN Cur LOOP

                IF (Rec.status = 'Ready' OR Rec.status = 'Go') THEN
                     IF Length(Rec.Zip) = 5 AND
               (Substr(Rec.Zip, 1, 3) = '303' OR
                Substr(Rec.Zip, 1, 3) = '304' ) THEN 

                        l_state:= 'ATL';                               
                    END IF;

          UPDATE status_log mil
             SET file_processed = 'Processed'
           WHERE current of cur        

        END IF;

COMMIT;
          END LOOP;

Now whenever the cursor has one record that satisfies the second IF(i.e Zip is 5 in length and the code starts with 303 or 304) it doesnt hit the update statement anymore for that records and all record after that. I even tried using the EXIT statement after the logic in the IF loop but to no avail. What am I doing wrong?

  • 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-27T18:08:27+00:00Added an answer on May 27, 2026 at 6:08 pm

    IFs aren’t loops. This may actually be an important point since you say you’ve tried using an EXIT, and the purpose of that statement is to exit from the immediately enclosing loop. In this case, that means the loop over the cursor (unless possibly your “code to do something” includes other loops). So any EXIT you put in there would have caused the entire loop to terminate.

    If it doesn’t execute the update, then the “code to do something” is either (a) using an explicit command that affects the flow control, such as EXIT, CONTINUE, or GOTO, or (b) encountering an error that is causing control to switch to some exception handler somewhere.

    If the execute is updating but failing, then you should be seeing an error — unless, again, there is an exception handler somewhere that is hiding it from you.

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

Sidebar

Related Questions

I'm going through Java For Everyone by Cay Horstmann. I'm a bit confused on
Hey everyone, I'm a bit new to SEO. I built a one page website
hello everyone I am newto programming and I am just a little bit confused.
Everyone in my office uses Macs and therefore most use Safari. We have a
Alright everyone this is a bit of a complicated setup so if I need
First off I am pretty new to C, so I probably just have a
I am brand new to using RegEx's and need a bit of a jump
I'm a bit confused with these C++ pointers and I would like to know
UPDATE: Solved, i'm an idiot, thank you everyone! Okay little bit weird.. I just
Hey everyone. I'm having a bit of trouble running a query / php combination

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.