Article ID: 296771
Article Last Modified on 4/7/2006
APPLIES TO
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.6 Service Pack 1
- Microsoft OLE DB Provider for Oracle Server 1.0
This article was previously published under Q296771
SYMPTOMS
When you use the Microsoft Oracle OLE DB Provider (MSDAORA) to open an ADO Recordset on a SELECT statement that contains a UNION in a sub-select query, you may receive the following error message:
RESOLUTION
This problem is fixed in MDAC 2.6 SP2 and all later versions of MDAC. A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next MDAC 2.6 service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:
NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
The English version of this fix should have the following file attributes or later:
Date Version Size File name Platform ----------------------------------------------------------- 04/20/2001 2.61.7420.0 229,648 Msdaora.dll x86
WORKAROUND
Either apply this hotfix, or do not use a UNION query in a sub-select.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
To reproduce the error, run the following Microsoft Visual Basic code:
NOTE: To run this code you must have both the Oracle client from Oracle Corporation installed and MDAC 2.6 installed.
Sub ORACLE_UNION_TEST() Dim conn As ADODB.Connection Dim rs As ADODB.recordset Set conn = New ADODB.Connection Set rs = New ADODB.recordset conn.Open "Provider=MSDAORA;Data Source=ORACLESERVER;" & _ "User ID=User1;Password=Password1;" On Error Resume Next conn.Execute "DROP TABLE TABLE1" conn.Execute "DROP TABLE TABLE2" On Error GoTo 0 conn.Execute "CREATE TABLE TABLE1(T1C1 NUMBER,T1C2 NUMBER)" conn.Execute "CREATE TABLE TABLE2(T2C1 NUMBER,T2C2 NUMBER)" conn.Execute "INSERT INTO TABLE1 VALUES(7,7)" conn.Execute "INSERT INTO TABLE1 VALUES(6,6)" conn.Execute "INSERT INTO TABLE2 VALUES(6,7)" rs.CursorLocation = adUseClient ' Error will occur here on recordset open. rs.Open "SELECT T1C1, T1C2 FROM TABLE1 " & _ "WHERE T1C1 IN " & _ "(SELECT T2C1 FROM TABLE2 UNION SELECT T2C2 FROM TABLE2)", _ conn, adOpenStatic, adLockOptimistic rs.Close Set rs = Nothing conn.Close Set conn = Nothing End Sub
Keywords: kbfix kbqfe kbprb kbhotfixserver KB296771