Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-02041

271367Jun 4 2003 — edited Jun 4 2003
I am getting this error when using a UNION that also goes through a DATABASE LINK. I am developing an application that will create a Recordset based on the results of this query. Here is the code (VB):

Private Sub PopulateCompanyComboBox()
'Create Recordset Selecting all Customer Names
SQLQuery = "SELECT DISTINCT Cust FROM (" & _
"SELECT DISTINCT QUOTE_COMP Cust FROM QUOTES " & _
"UNION " & _
"SELECT CU_NAME Cust FROM CU@QSDB_PK1) " & _
"ORDER BY Cust"
'MsgBox SQLQuery
Set OraRec = New ADODB.Recordset
OraRec.Open SQLQuery, OraCon1, adOpenStatic, adLockOptimistic, adCmdText
If OraRec.RecordCount = 0 Then
Exit Sub
OraRec.Close
Set OraRec = Nothing
Else
OraRec.MoveFirst
cmbCustomer.Clear

Do While Not OraRec.EOF
cmbCustomer.AddItem OraRec!CU_NAME
OraRec.MoveNext
Loop
OraRec.Close
Set OraRec = Nothing
End If
End Sub

I'm getting the error when opening the recordset. The description of the error doesn't make sense in regards to my program. I can run the query from SQL*Plus and get the results. Can someone help me out? Thanks, Jeremy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2003
Added on Jun 4 2003
1 comment
121 views