%NOTFOUND - Question on why the EXIT condition is placed right after FETCH

So i have a procedure that uses a cursor as well as a loop to output the values as follows
LOOP
/* Retrieve each row of the result of the above query into PL/SQL variables: */
FETCH AREA_CUR INTO P_ID, P_LAST_NAME, P_DEPTH;
/* If there are no more rows to fetch, exit the loop: */
EXIT WHEN AREA_CUR%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Student ID: '||P_ID);
DBMS_OUTPUT.PUT_LINE('Student Last Name: '||P_LAST_NAME);
DBMS_OUTPUT.PUT_LINE('Depth: '||P_DEPTH);
END LOOP;
Right now, if i were to run my procedure i would get output of
Schmidt
Burha
Which is expected
But i noticed if i were to switch the EXIT statement to the end just before the end loop i get slightly different results
LOOP
/* Retrieve each row of the result of the above query into PL/SQL variables: */
FETCH AREA_CUR INTO P_ID, P_LAST_NAME, P_DEPTH;
DBMS_OUTPUT.PUT_LINE('Student ID: '||P_ID);
DBMS_OUTPUT.PUT_LINE('Student Last Name: '||P_LAST_NAME);
DBMS_OUTPUT.PUT_LINE('Depth: '||P_DEPTH);
/* If there are no more rows to fetch, exit the loop: */
EXIT WHEN AREA_CUR%NOTFOUND;
END LOOP;
I then get the results of
Schmidt
Buhra
Burha
From what I understand after a FETCH statement is issued, it will take the current value of the row its in and then also move to the next line.
Why would it pick up Burha twice?
Since the FETCH statement moves to the next line i would expect the output to look more like
Schmidt
Buhra
<Blank> (as this would be the newest line)
Am i misunderstanding this?

You are saying that since there is no value to be fetched into variables, then variables in the FETCH stmt should hold NULL values, right? But there is no row (NOT EVEN NULL) to be fetched, therefore variables retain their values.
And %notfound is a boolean attribute that returns false if the previous fetch returned a row* and true if it didn't, hence we use exit after fetch statement and not at end of loop; Or we may get different results as in your case!
Mahanam

Similar Messages

  • I am walking through Apples tutorial getting started with iOS development. I am at the storyboard area and can't seem to drag the cancel button to the green exit. I am not sure why the exit button doesn't except it. Is anyone else having this issue?

    I am walking through Apples tutorial getting started with iOS development. I am at the storyboard area and can't seem to drag the cancel button to the green exit. I am not sure why the exit button doesn't except it. Is anyone else having this issue? Is there a work around? I have done this app twice and still cant get the exit to except the Cancel or Done  bar buttons

    Yes I checked it.  As far as I can see I did everything Apple said to do.  I took some screen shot so you can see how the screens are connected and what and where the code is, and what it does when I drag the cancel and done bar buttons to the exit

  • Why the App Store ask for sq.after using it for years and how do find the answers

    Why the App Store ask for sq.after using it for years and how do find the answers

    Reset security questions
    http://support.apple.com/kb/HT5312
    If you do not have a Rescue email, you need to contact apple support, they will guide you through the process of resetting your security questions.
    https://ssl.apple.com/emea/support/itunes/contact.html

  • HT5312 Guys, I have forgotten my security question answers, and the rescue email I placed in with my apple id has been closed down as well (it was a university id, when I graduated, the email service expired). I need help changing my password.

    Guys, I have forgotten my security question answers, and the rescue email I placed in with my apple id has been closed down as well (it was a university id, when I graduated, the email service expired). I need help changing my password.

    The Three Best Alternatives for Security Questions and Rescue Mail
        1. Use Apple's Express Lane.
              Go to https://expresslane.apple.com ; click 'See all products and services' at the
              bottom of the page. In the next page click 'More Products and Services, then
              'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
              ID security questions' and click 'Continue'.
         2.  Call Apple Support in your country: Customer Service: Contact Apple support.
         3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • Why the permiere pro cs5 keeps crashing after importing videos?

    Hi, I'm working with the cs5.0 on the HP PAVILIONA1-PC and I'm trying to improt the 203MB avi flies for my client.  The problem is that everytime that after I import the videos and bring into the source  monitor, it just froze and crashes on me.  Can someone help me, I have a deadline.

    1st, you are in the wrong forum, you should be in http://forums.adobe.com/community/premiere for CS5
    2nd, Windows CS5 is at version 5.0.3 which has MANY updates and bug fixes... you need to update
    All Adobe updates start here and select product, read to see if you need to install updates in number order, or if the updates are cumulative for the individual product http://www.adobe.com/downloads/updates/
    3rd, AVI is like saying a loaf of bread... white, whole wheat, raisin... or...???
    Read Bill Hunt on a file type as WRAPPER http://forums.adobe.com/thread/440037
    What is a CODEC... a Primer http://forums.adobe.com/thread/546811
    What CODEC is INSIDE that file? http://forums.adobe.com/thread/440037
    Report back with the codec details of your file, use the programs below... A screen shot works well to SHOW people what you are doing
    http://forums.adobe.com/thread/592070?tstart=30
    For PC http://mediainfo.sourceforge.net/en or http://www.headbands.com/gspot/
    4th, for future knowledge, the information you need to provide when asking a question
    Information FAQ http://forums.adobe.com/message/4200840

  • Why the flash player don't work after installing the video downloader add-on?

    I've installed and uninstall the Firefox mobile app several times to try and fix this issue. Every time I add the video downloader add-on the flash player won't let me tap to play videos anymore. I've tried to completely enable the flash but still didn't work. I've used this add on for a few months and it worked fine up until the last Firefox update. Without the add-on the flash player works fine but after I've added the video downloader add-on I would have to uninstall and reinstall the mobile spot to get the flash to work again. I really love to use this add-on that's the advantage that Firefox mobile app has over other web browser. Please tell me how I can fix this issue. THANKS

    Hello FRYDAE
    Welcome to SuMo help Forum,
    Thankyou for reaching us here
    About your problem , have you tried to clear your privacy/browsing data? And see if flash works?
    And you can try to disable the add-on, if you don't want to use it . and enable it again if you want to download a video .
    Cheers!

  • Why the removed flag will be resumed after re-sync with MS Exchange server (2010)

    Dear Sir:
         I had a big problem using Lion mail application. I like the program since it's quite simple and useful. But this problem makes me not able to work with Lion mail program continaully.
         In Lion mail, I import my office mail account which based on MS Exchange server 2010. I just found some mails (sorry I cannot fina any rule) which ever be flagged, when I try to un-flag them. The flag status will come back after re-sync with mail server. But the status doesn't happen with all mails I had. One thing I can confirm is, the "specific" mail doesn't be marked with any status after I checked them using Outlook application (both Mac Office 2011 or Windows Office 2010). Have you ever received similar feedback? Please help me to resolve this issue ASAP. Thank you.
    -Joseph

    When the original message is accessed using IMAP, the reply method uses the information in the
    IMAP ENVELOPE to determine where to send the reply. It first looks for the Reply-To address
    in the ENVELOPE, then the From address.
    Interestingly, when not using IMAP, the getFrom method returns the Sender header if the From
    header is empty. The IMAP-specific code doesn't do that, although perhaps it should.
    It would be interesting to compare the ENVELOPE data from the protocol trace in the two cases.
    The ENVELOPE data will follow this syntax:
    envelope     = "(" env-date SP env-subject SP env-from SP
              env-sender SP env-reply-to SP env-to SP env-cc SP
              env-bcc SP env-in-reply-to SP env-message-id ")"
    So it's the first three address fields after the Subject that are relevant. If the From and Reply-To
    fields are NIL, but the Sender field has a valid address, let me know. I should probably fix the
    IMAP provider to fall back to the Sender field if the From field is missing.

  • What's My Security Questions and why the itunes ain't woking on my laptop plz help

    HI My Name IS ANJELICA MORAGA I HAVE A QUESTION  WHY ITUNES AIN'T WORKING ON MY HP LAP TOP I RESET THE PASSWORD AND I WENT INTO THE SECURITY AND PASSWORD IT DIDN'T NOT SHOW RESET SECURITY QUESTION SHOULD I MAKE A NEW APPLE ID WITH AOL.COM OR GET A MAC LAP TOP!! I TRY THE CALL SUPPORT BUT THEY TOLD ME I HAVE TO GO TO APPLE SUPPORT I WAS SO CONFUESS WHAT SHOULD I DO IF I MAKE A APPLE ID NEW ONE WOULD IT MISS UP THE ITUNE CARD I PUT N $100.47 THREE DAYS AGO AND MY ID IS STILL LOCKED!! WOULD I GET MY MONEY BACK IF I MAKE A NEW APPLE ID??

    If you haven't received the email to your rescue email account (and you've checked the spam folder on that account as well as the inbox, and tried clicking the reset link again) then you will need to contact Support in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/ kb/HT5699
    When they've been reset you can then use the steps on this page to check that your rescue email address is correct for potential future use : http://support.apple.com/kb/ HT5620
    Or, if it's available in your country, you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • Do someone knows why the secondary click does´t work after the mac os lion´s installation?

    Well,after that I´ve installed the new Mac OSX Lion...and navigate trough the panel,I see that the secondary click doesn´t work. I mark it in the trackpad´s panel but when I open it again,it shows the option with no mark,do someone knows why?

    Same here. Tried a restart but that didn't help.

  • Why the click sound is not working after publishing?

    Hello all.
    I have around 190-200 slides in my project. I want my mouse object to have the click sound in some slides and without click sound in rest of the slides.
    Using its properties panel I have added click sound for the required slides. But after  publishing the project I am unable to hear the click sound. When I refresh the page I could hear the sound. Why does this happen?
    Regards,
    Kartik.P

    Hi,
    Do you face this problem even with a single slide project? Because this seems to be working fine at our end.
    Also, is it an upgraded project, single click or double click?? Does it happen only on few slides or all slides with mouse click sound.
    Thanks,
    Sikandar

  • Why the photo app is not closing after i finish, when i take a picture accessing directly from home screen. the location is draining my battery if I'm not closing the app by double click home button. in iOS 6 was not like this

    When im taking a picture directly from home screen after im finished the application remain open. This app is ussing the location and if im not closing like other applications by doble click the home button the batery will finished fast. On the other IOS 5 and 6 was not neccesary to unblock the phone and bouble click the home bottom.

    Reinstalling OS X Without Erasing the Drive
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Reinstalling OS X Without Erasing the Drive
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility and press the Continue button. After Disk Utility loads select the Macintosh HD entry from the the left side list.  Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit Disk Utility and return to the main menu.
    Reinstall OS X: Select Reinstall OS X and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
    Alternatively, see:
    Reinstall OS X Without Erasing the Drive
    Choose the version you have installed now:
    OS X Yosemite- Reinstall OS X
    OS X Mavericks- Reinstall OS X
    OS X Mountain Lion- Reinstall OS X
    OS X Lion- Reinstall Mac OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it is three times faster than wireless.

  • Any ideas on why the hipkey won't turn on after recharge?

    i have a hipkey that won't turn on with or without the app being displayed.. any ideas would be appreciated..

    Contact the manufacturer.
    Barry

  • What is the "Error! Check Authorization" message and why does my Digital Editions crash right after that pops up?

    I have authorized the Adobe Digital Editions with both my PC and my eReader. I try to download a library book and I get the "Error! Check Authorization" message. My Digital Editions will then crash.

    Hello,
    Please download the latest ADE 4.0.3.114137
    http://www.adobe.com/solutions/ebook/digital-editions/download.html
    Some of the crashes have been fixed in this release.
    Thanks for being the part of product improvement.

  • [Android][Other] the "X" {close} button not right after the " " {next} button in lockscreen

    do you listen to spotify while commuting?Well, wouldn't you wisht that the spotify lockscreen player buttons would be bigger and that the "X" {close} button would not be really close in space to the ">>" {next}  button. Well I would.Its frustrating when I'm listening to a song I don't like, while im driving, then i click the next button but i accidentally click the close button and the music stop. Now I can't listen to my music because I'm driving and now it involves unlocking my phone and going back to spotify while i'm driving /; not so safe.  Attechment shows a comparison between Spotify and Google Music in the lockscreen 

    You mean like windows 7 behaviour where the red area appears behind a white X as you mouse over?
    I would do that by putting the X in a button.
    You then have something concrete there to work with.
    Change the background color on mouseenter and again on mouseleave.
    Otherwise you'd have to work out whether the mouse was over that X you drew on there.  And I think that'd be difficult.
    Or am I missing something?
    Why are you using Drawstring to draw an X on there?
    By the way, you should really be asking windows forms questions in the windows forms forum.
    It's in your interest as you ought to get more windows forms developers hang out there.
    In theory anyhow.
    Hope that helps.
    Technet articles: Uneventful MVVM;
    All my Technet Articles

  • Is the mini going to upgrade right after I buy a new one?

    A few years ago I bought the mac mini and a few months later they upgraded with the intel chip. I am planning on buying the latest version and I'm wondering if anyone has heard if they're going to upgrade soon and should I just wait.

    Hello and welcome to discussions,
    No one here knows that. If anyone did know - They would never say so here. If you google the question or a variant of same... Who knows what you might find out!!!
    Regards.
    Ian.

Maybe you are looking for