This appears to be a bug discovered fairly recently. Metalink Bug 1045196 describes the exact problem. Hopefully a patch will be released soon. For those of you who can't get past the Metalink wall here are a few details:
Metalink
Bug 10425196: PL/SQL RETURNING REF CURSOR ACTS DIFFERENTLY ON 11.1.0.6 VS 10.2.0.5
Type: Defect
Severity: 2 - Severe Loss of Service
Status: Code Bug
Created: 22-Dec-2010
DIAGNOSTIC ANALYSIS from original case submission:
- 10.2.0.4 Windows Expected Behavior
- 10.2.0.5 Solaris Expected Behavior
- 11.1.0.6 Solaris Un-Expected Behavior
- 11.1.0.7 Windows Un-Expected Behavior
- 11.2.0.1 Solaris Un-Expected Behavior
- 11.2.0.2 Solaris Un-Expected Behavior
FURTHER DETAILS I can confirm:
- 10.2.0.3 Windows Expected Behavior
- 11.2.0.1 Windows Un-Expected Behavior
Additional Details
Changing the OPTIMIZER_FEATURES_ENABLE='10.2.0.4' parameter does not resolve the problem. So it seems to be related more to a design change in the 11g database engine rather than an optimizer tweak.
Code Workaround
This appears to be a result of the use of the index when querying the table and not the act of updating the table and/or committing. Using my example above, here are two ways to ensure the query does not use the index. Both may affect the performance of the query.
Affecting the performance of the query might be temporarily acceptable until a patch is released but I believe that using FLASHBACK as @Edgar Chupit suggested could affect the performance of the entire instance (or may not be available on some instances) so that option may not be acceptable for some. Either way, at this point in time code changes appear to be the only known workaround.
Method 1: Change your code to wrap the column in a function to prevent the unique index on this one column from being used. In my case this is acceptable because although the column is unique it will never contain lower case characters.
SELECT col1
FROM tbl1
WHERE UPPER(col1) = 'TEST1'
AND col2 = 0;
Method 2: Change your query to use a hint preventing the index from being used. You might expect the NO_INDEX(unique_col1) hint to work, but it does not. The RULE hint does not work. You can use the FULL(tbl1) hint but it's likely that this may slow down your query more than using method 1.
SELECT /*+ FULL(tbl1) */ col1
FROM tbl1
WHERE col1 = 'TEST1'
AND col2 = 0;
Oracle's Response and Proposed Workaround
Oracle support has finally responded with the following Metalink update:
Oracle Support - July 20, 2011 5:51:19 AM GMT-07:00 [ODM Proposed Solution(s)]
Development has reported this will be a significant issue to fix and
has suggested that the following workaround be applied:
edit init.ora/spfile with the following undocumented parameter:
"_row_cr" = false
Oracle Support - July 20, 2011 5:49:20 AM GMT-07:00 [ODM Cause Justification]
Development has determined this to be a defect
Oracle Support - July 20, 2011 5:48:27 AM GMT-07:00 [ODM Cause Determination]
Cause has been traced to a row source cursor optimization
Oracle Support - July 20, 2011 5:47:27 AM GMT-07:00 [ODM Issue Verification]
Development has confirmed this to be an issue in 11.2.0.1
After some further correspondence it sounds as though this isn't being treated as a bug so much as a design decision moving forward:
Oracle Support - July 21, 2011 5:58:07 AM GMT-07:00 [ODM Proposed Solution Justif]
From 10.2.0.5 onward (which includes 11.2.0.2) we have an optimization called
ROW CR it is only applicable to queries which use an unique index to
determine the row in the table.
A brief overview of this optimization is that we try to avoid rollbacks while
constructing a CR block if the present block has no uncommitted changes.
So the difference seen in 11.2.0.2 is because of this optimization. The
suggested workaround is to turn off of this optimization so that things will
work exactly as they used to work in 10.2.0.4
In our case, given our client environments and since it is isolated to a single stored procedure we will continue to use our code workaround to prevent any unknown instance-wide side effects from affecting other applications and users.
One of my teammate found the answer. The problem was in the installation and here is what worked:
Warning for Windows7 only:
Oracle 10g installation on windows 7
32-bit completes without error but it is incomplete. In order to fix
the problem, before installing Oracle, shut down your PC, unplug your
network cable, boot your PC and install Oracle (not a joke), and
reconnect only after the installation of Oracle 10g.
That is weird, but it worked
NOTE----This method doesn't worked with 11g express R2 . (ofcourse i am talking of windows 7)
Best Answer
There is commonly no problem to connect to an older Oracle database with a newer client driver, e.g. to connect to a 10g or 11g database with a 12g Client. The rest of the answer belongs to technical problems which can occur in your .Net program in the case that an Oracle Client is (maybe) already installed on the computer executing your program.
Update 2014:
In the meanwhile Oracle has released a managed .Net driver for the Oracle database. So instead of installing a local Oracle Client or delivering an Instant Client along with your app, the preferred way should be to deliver just the managed driver without any dependencies to local configurations. Then you have no trouble with installed clients, the GAC, the Oracle database version and so on. You can download the managed driver from the Oracle website.
Previous answer, still needed if you can't use the managed driver:
The problems begin if you don't know if there is an Oracle client installed on your client workstations. If you are talking about GAC I assume, you don't know if an Oracle Client is installed and if so, which version it is.
If you don't want to rely on an installed Oracle Client, you can deliver an Oracle Instant Client with your .Net application. For example you can download ODAC 11.2 Release 4 (11.2.0.3.0) with Oracle Developer Tools for Visual Studio, which gives you an Oracle Client installation for your developer workstation (with Visual Studio support for DataSet development and EntityFramework) as well as all files needed for an instant client.
For an instant client you need the following files (search them in the subfolders of your ODAC installation):
In addition the following .dll files are needed from your Windows directory:
Just copy all that files in the working directory of your application (where the .exe file is).
Now how belongs that to the GAC?
If an Oracle Client is installed on the client machine there is also an Oracle.DataAccess.dll in the GAC. Also it is possible, that a policy was installed which states something like: Independant of the Oracle.DataAccess.dll your program is referencing, the Oracle.DataAccess.dll version from your GAC shall always be used. If you install the ODAC I linked above, you find that file under
The result is that your .Net application always throws an exception if you are trying to load the Oracle.DataAccess.dll (with an error message like "The provider is not compatible..."), if the client machine has another version of Oracle Client 11 installed than the one you are referencing in your application.
To solve that, you can configure your app.conf so that the publisher policy will be ignored and always your version is loaded: