Why does this snippet produce ORA-01002 in 10g, but works fine in 9i.

While migrating from 9i to 10g, we found that one of our processes failed with ORA-01002: fetch out of sequence. Debugging produced the following example:
DECLARE
CURSOR A IS SELECT Dummy FROM Dual FOR UPDATE;
BEGIN
FOR B IN A LOOP COMMIT;  END LOOP;
END;This code works in 9i, but produces an EXCEPTION in 10g:
SQL> SELECT Banner FROM V$Version;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
CORE    9.2.0.8.0       Production
TNS for Linux: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
SQL> DECLARE
  2   CURSOR A IS SELECT Dummy FROM Dual FOR UPDATE;
  3  BEGIN
  4   FOR B IN A LOOP COMMIT;  END LOOP;
  5  END;
  6  /
PL/SQL procedure successfully completed.
SQL> SELECT Banner FROM V$Version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> DECLARE
  2   CURSOR A IS SELECT Dummy FROM Dual FOR UPDATE;
  3  BEGIN
  4   FOR B IN A LOOP COMMIT;  END LOOP;
  5  END;
  6  /
DECLARE
ERROR at line 1:
ORA-01002: fetch out of sequence
ORA-06512: at line 4The documentation on the error explains this case in both 9i and more explicitly 10g. Should this have produced the EXCEPTION in 9i as well? Or, is there something else about 10g?

e.g. a FOR row IN cursor LOOP is now implicit using a bulk fetch operation (100 rows or so).This was also my first guess, but said optimization does not take place when the cursor is defined FOR UPDATE:
SQL> exec dbms_application_info.set_client_info(0)
PL/SQL procedure successfully completed.
SQL> declare
cursor a is select last_name, set_client_info(rownum) from employees;
begin
for b in a loop
    exit; 
end loop;
end;
PL/SQL procedure successfully completed.
SQL> select sys_context('userenv','client_info') from dual
SYS_CONTEXT('USERENV','CLIENT_INFO')                                           
100                                                                            
1 row selected.
Now with FOR UPDATE:
SQL> exec dbms_application_info.set_client_info(0)
PL/SQL procedure successfully completed.
SQL> declare
cursor a is select last_name, set_client_info(rownum) from employees for update;
begin
for b in a loop
    exit; 
end loop;
end;
PL/SQL procedure successfully completed.
SQL> select sys_context('userenv','client_info') from dual
SYS_CONTEXT('USERENV','CLIENT_INFO')                                           
1                                                                              
1 row selected.

Similar Messages

  • Why does my slideshow stop on my live site, but works fine in test?

    I have an auto-play slideshow of 7 images that stops after 4 on our live
    website. If you click the arrow to advance, the next three images never
    load.
    http://www.baidesign.com/our-process.html
    However, when I test it—preview page and business catalyst— it plays through
    to 7, then replays (what I want)
    http://baitestsite.businesscatalyst.com/our-process.html
    I have tried rebuilding it, but that didn't help. Can't think of anything.
    The whole site is full of slideshows. Other than the horizontal transition,
    this one is not much different. I have checked the file names of the images
    and updated the assets.
    Please help! We would like to announce the new website to our clients.

    Hello
    If the slideshow is working fine in Business Catalyst and not on another (external) host, the issue may be with the upload not being completely successful, or the host itself. Please make sure it's not an upload issue, by reuploading the site again with "all files" selected in the upload option. If that doesn't resolve the issue, then have your host "reset the FTP permissions" for you and then reupload the site to see if that fixes the issue.
    Cheers
    Parikshit

  • Why does this cause error (ORA 01008: Not all variables bound)

    When I assign values to parameters for a command object, I used the following code with the .NET provider:
    If oReq.CritSpec = Nothing Or oReq.CritSpec = "" Then
    cmdReq.Parameters.Add(":po5", DBNull.Value)
    Else
    cmdReq.Parameters.Add(":po5", oReq.CritSpec)
    End If
    This works fine, but when I switch to using ODP it generates the 'not all variables bound' error. I checked the parameter's status and it was Success. However, if I change the second line of the statement to
    If oReq.CritSpec = Nothing Or oReq.CritSpec = "" Then
    cmdReq.Parameters.Add(":po5", OracleDbType.Varchar2, DBNull.Value, ParameterDirection.Input)
    Else
    cmdReq.Parameters.Add(":po5", nReq.CritSpec)
    End If
    It seems to be OK. So my question is - why does the first statement generate the error? Am I misinterpreting the overloaded constructor or it it a bug in my code? Thanks.
    ck

    No need to answer, I solved it.
    For anyone else who might run into this, there were two issues:
    1. Assigning DBNull.Value to a parameter without specifying the parameter's type causes the Value property for that parameter to not be initialized. If you reference it, it will come back as a runtime error (check it first by testing for IsNot Nothing).
    2. In my update code, I have a lot of where clauses like "WHERE (COL1 = :1 OR COL1 IS NULL AND :1 IS NULL)". The default binding for parameters treats these two references to :1 as two different parameters. Setting BindByName to true solves the problem.
    ck
    Edited by: user536671 on Feb 15, 2009 7:04 PM

  • Why are my steppers misbehaving in closed loop mode, but work fine in open loop

    I have a 7344 controlling a 4 axis prototype machine, which is configured with 50,000 steps/rev and linear encoders providing 50800 counts per inch. The physical properties of the machine are less than perfect (prototype!), so there is a considerable amount of backlash in the hardware (about 0.008" - 0.010").
    The observed behaviour is as follows: when repeatedly blending in the X,Y plane using vector space 1 in closed loop mode, an axis will be driven (uncommanded) to the zero encoder reading (home position) occasionally (about 1 move in 600). I have kept a log of the commanded positions being passed to the controller (via the flex_load_vs_position function) and a move to zero is not being com
    manded. The application is single-threaded, so there is no chance of race conditions. The ready state of the board is being confirmed by means of the flex_check_blend_complete function call before any blend is commanded. The programmed relationship between steps and counts/revolution have been independantly confirmed as being correct.
    An A-B-A test with the only change being to initialise the X & Y steppers in open loop instead of closed loop then 'works' - although the physical positioning of the hardware is unsatisfactory due to the physical characteristics of the prototype machine already mentioned, hence the necessity to run closed loop.
    I am inclined to interpret the evidence as suggesting that the 7344 is causing an 'occasional' uncommanded move to zero as a result of some interaction between pull-in moves and commanded position on a system where there is a considerable degree of 'elasticity' between the commanded position and the achieved position allied to a rapid-fire de
    livery of blend moves.
    This problem can be replicated under versions 5.0.1 and 5.2 of the FlexMotion software.
    I can clearly run without bumping into the problem by running open loop, but unfortunately that is not acceptable in this situation. Any ideas, anyone?

    Hi, and thanks for coming back so promptly. I think I need to give you some more information - sorry if it turns into a long post!
    The system behaviour when it 'misbehaves' is that it starts the anomolous behaviour well clear of any home or limit switch (>6"). When it 'goes wrong', it then slews one or both axes to the zero position. Having arrived at the zero position, it then carries on with the next blend without killing the motor.
    The initialisation functions include a seek to home switch, a search for the nearest index point, and a zeroing of the encoder count at the index pulse: hence the zero point is a little displaced from the home microswitch.
    I believe that once the system has 'gone wrong', it is stopping at the zero point *not* the h
    ome switch.
    I have carried out some further tests that may be of help:
    If I place a large (1 sec) inter-blend delay in the calling functions, the anomalous behaviour is not noticed. However, the start/stop nature of each move means that this test is knocking the bejezus out of a rather fragile prototype machine, so I can't do this too often!
    The encoder positions are being read back on each move cycle and monitored, and they are not showing any anomolous behaviour, so I don't think they are the culprit. I have placed a 'scope on the quadrature encoder inputs and the edges are good and sharp with no real indications of noise.
    I could test with a blend factor other than -1 if you think that might be illuminating?"

  • Why won't Words With Friends open in Firefox but works fine with IE?

    The game "Words with Friends" worked fine until firefox update and Words with Friends new version. Now it will not open. Tried all the support suggestions to no avail. Then I tried it through IE and it works fine.

    -> Update Firefox to the latest version 10
    * [[Installing Firefox on Windows]]
    Perform the suggestions mentioned in the following articles:
    * [https://support.mozilla.com/en-US/kb/Template:clearCookiesCache/ Clear Cookies & Cache]
    * [[Troubleshooting extensions and themes]]
    Check and tell if its working.
    May not be related to your problem but some of your Firefox Plugins are out-dated
    * Update All your Firefox Plugins -> [https://www.mozilla.org/en-US/plugincheck/]
    * '''When Downloading Plugins Update setup files, Remove Checkmark from Downloading other Optional Softwares with your Plugins (e.g. Toolbars, McAfee, Google Chrome, etc.)'''

  • My 3rd gen apple tv will loose all sound output once in a while... why does this happen?

    my 3rd gen apple tv will loose all sound output once in a while... why does this happen? when i come home from work and turn on apple tv there is no sound. not even the sound effect when you move your selection cursor around the home screen. ive called into apple support and they were really helpful. the problem was at the time that i needed to sign out of apple and back in after i update the software. this is recurring now off and on for 2 weeks. does anyone have any ideas?

    Hi,
    Beacon Interval - 400
    Threshold - 2346
    RTS - 2347
    DTIM interval - 1
    CTS protection mode - Disabled
    Basic rate - Default
    Transmittion rate - Auto(Negotiating)
    So the other client must have that settings on network adapter Control Panel->Network Connections->configure->Link Speed Duplex - Auto(Default settings).
    I hope that to be helpfull for you,if not please let me know.
    Thanks!!!!!!
    George
    Thanks
    Kind Regards
    ing.George Gochev
    DSL and Telecommunications Engineer

  • I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great

    I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great!

    The fact that you can receive means you have a valid e mail address, and have established the connection to the incoming server, so all of that works.  Since the send does not work, that means your outgoing server is rejecting whatever settings you used formthe outgoing set up.  Try them again. 
    Google your particular isp, and ipad and many times you will find the exact settings needed for your isp.  Or tell us here, and soneone else may be on the same isp.  Some mail services need you to change a port, or have a unique name for the outgoing server.  
    Kep trying.

  • HT201209 iTunes will not use the redeemed gift cards on my account, I have a $30 credit and when I try to purchase a song it goes right to my credit card on file. Why does this keep happening

    iTunes will not use the redeemed gift cards on my account, I have a $30 credit and when I try to purchase a song it goes right to my credit card on file. Why does this keep happening???

    Any time you've changed anything in your billing, it does this once to very things.

  • TS4062 when i sync my iphone a large portion of my music does not download but rather stays in the cloud. then i must download it from the cloud. why does this happen and how can i stop it from happening

    every time that i sync my iphone with a cord to my imac some large portion of my music is placed in the cloud so that i must down load it from the cloud. this includes music that i have purchased on itunes and other music. it seems random.
    why does this happen? is it a setting? i want to stop it. and music that w

    It was gift back in September. You can follow the instructions in the link below to remove them:
    Remove iTunes gift album "Songs of Innocence" from your iTunes music library and purchases - Apple Support

  • My iphone is suddenly populated by random songs I've downloaded in the past. Why does this happen, and what are apple doing about fixing this?

    Why does this happen?
    What do other people do? (I can't go to sleep knowing there's a rogue album or song in my music. It's 2am now)
    What do we tell apple so that they actually fix it. None of us want to pay £25 to have our own music.

    I am on the monthly payment plan because nobody at BT has told me there is any alternative!
    Each year there I have a long, in-depth conversation with the person who sets up the contract for the next year but the gist of the thing is 'I'm  not going to be paying more than [x amount] per month, am I? Because I can't afford any more'' and each year the person says that no, in fact I should be paying less... and then without notice and even with the bill saying 'We will continue to take....' a totally different - and higher - sum disappears from my bank account.
    Then I go through the painful process of writing to complain about this, get some sort of sum refunded and then the payments go through at the level they should, with me paying any additional (usually small) amounts for usage over the allowance. Until contract end when we start all over again...
    Even if the amount they seem to randomly decide on is based on some sort of forecast, this should not be happening as I am doing what they instruct me to do on the bill to keep my payments the same.
    So something is going wrong, on many levels.
    At no point have I been offered the sort of 'monthly billing' described here; maybe there is some reason I am not allowed it. Unfortunately 'whole bill' direct debit payment is beyond me. I really need to know what I will be paying each month and I need BT to correctly take that amount, as agreed, each month, from the get-go.
    It shouldn't be that hard really! Does anyone from BT read these forums? Can somebody take this on and finally get this straight, please?

  • Why does this message keep appearing when i try to instal windows 7 through bootcamp? - "something went wrong and the USB cannot be configured for the installation"

    Why does this message keep appearing when Itry to instal windows 7 through bootcamp? - "Your bootable USB drive could not be created. An error occurred while copying the Windows installation files."

    Found a solution!
    Follow the extended version of these directions here:
    https://discussions.apple.com/docs/DOC-3581
    Worked like a charm!

  • HT2500 I sometimes get e-mails where the sender sends me several PDF's attachments. These attachments appear already opened on the e-mail unlike most PDF's which I open by clicking on the PDF icon. Why does this happen?

    I sometimes get e-mails with pdf attachments. However instead of opening a PDF icon the body of the e-mail message has the PDF's already opened. Why does this happen? Is there anything I can change on my mac book pro to make these PDF's come thru with their individual icons which can then be opened.

    This is a long-standing design flaw in Apple Mail.
    Prior to Mavericks, this command in Terminal would stop the annoying behavior:
    defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
    This Terminal command stopped working in Mail 7.1 under Mavericks. I have reported this to Apple as both a feature request and a bug. You should too.
    http://www.apple.com/feeback

  • HT2470 Why does this not explain how to change the sort order?

    Why does this (i.e. support at Apple.com) not explain how to change the sort order? I can "arrange" by Date Modified for example but it won't let me switch to use most recent dates first. Also, what is Apple-speak for arrange versus sort anyway? It seems I used to be able to click on a column heading in finder and get a drop down arrow allowing me to change the sort sequence.

    Arrange roughly translates to "group the items in the folder." Sort is how each group is ordered. If you have arrange set to none, you can sort by anything. However, there is no way in the Arrange/Sort menu to choose the direction. The only way to do that is in the List View, and you must have Arrangement set to None.
    I've submitted an Enhancement Request to allow choosing sort direction from the Arrange/Sort menu, but I haven't ever gotten a response, which is good and bad. Good because they will often respond that they have considered it and don't plan on implementing. Bad in that they've haven't implemented it.

  • HP Photosmart C8180 Printer! WHY does this keep happening every day??

    I have only had this for 3 months and it already has problems.
    It keeps telling me its out of paper when it is not.
    i always have at least 20 sheets in there!
    You can hear the rollers going but it can't pick up the paper and I only use high quality A4 paper in there.
    i then have to pull the tray out and push it back in, and yes i have the paper inserted in there correctly
    also, sometimes when i get this "out of paper" message, i ignore it and just press OK and it works fine 
    why does this keep happening?
    this is disgusting coming from a Quality brand like HP
    think its time to go to BBC Watchdog! 
    A printer is an item meant to print. 
    It is generally helpful if a printer recognizes such out-of-the-ordinary, eccentric, unheard-of media such as...oh, I dunno, 8.5 x 11-inch PAPER?????
    It claims repeatedly to have run out of paper. No paper. No paper. Insert paper into paper tray. Now, granted, the minimalist quality of the paper tray--it holds 20 pages, roughly--might convince you that I had indeed used up all my paper; this is not the case. 18 of the 20 sheets are still there. So I readjust that paper, close the tray. It starts to pull in a piece of paper, and then there is the giant crunchy noise of a paper jam in progress. And forget about “easy access” for removing them, either.
    In the months I have had this printer, I don’t believe it has EVER allowed me to print five pages consecutively without some sort of problem.  To me, this is known as an EPIC FAIL. 
    Message Edited by Waynester on 04-16-2009 04:09 PM

    So how is the printer set up?  Is it wireless or USB?  If USB you will need a cable, purchased seperately.  It is a standard A/B USB cable widely available inexpensively.  (The $1 cables form the dollar store work fine....
    Running the diagnostics at http://www.hp.com/go/tools may help resolve the issue.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • I have songs i ripped from cds on my computer.  after a while, some of them have started to skip? why does this happen? do i have to rip them all over again?

    i have songs i ripped from cds on my computer.  after a while, some of them have started to skip.  why does this happen?  do i have to rip them all over again?

    See Recover your iTunes library from your iPod or iOS device.
    tt2

Maybe you are looking for