Q
Problem solve Get help with specific problems with your technologies, process and projects.

Error on connecting Visual Basic with Oracle 9i using ODBC

I want to connect Visual Basic with Oracle 9i using ODBC. I have a package in the server:

CREATE OR REPLACE PACKAGE CONSULTA AS TYPE TLB_NOMBRES IS TABLE OF EMP.ENAME%TYPE INDEX BY BINARY_INTEGER; 
PROCEDURE NOMBRES_EMP (P_DEPARTAMENTO IN EMP.DEPTNO%TYPE , P_NOMBRES 
OUT TLB_NOMBRES); END CONSULTA;

And the body is this:

CREATE OR REPLACE PACKAGE BODY CONSULTA IS  PROCEDURE NOMBRES_EMP  (P_DEPARTAMENTO IN EMP.DEPTNO%TYPE , P_NOMBRES OUT TLB_NOMBRES) IS CURSOR GET_NOMBRES IS

     SELECT ENAME FROM EMP WHERE DEPTNO = P_DEPARTAMENTO;

 TABLE_INDEX NUMBER:= 1;
 
   BEGIN
 
     FOR GET_NOMBRES_CUR IN GET_NOMBRES LOOP
 
     P_NOMBRES(TABLE_INDEX):= GET_NOMBRES_CUR.ENAME;
 
     TABLE_INDEX:= TABLE_INDEX + 1;
 
   END LOOP;
 
   END;
 
   END;

In the Visual Basic program:

Public cn As New ADODB.Connection
 
Public rs As New ADODB.Recordset
 
cn.ConnectionString = "dsn=ORACLE;uid=scott;pwd=tiger"

cn.Open
   msSelect = "{call consulta.nombres_emp(" & CInt(Text1.Text) & ", " 
& _"{resultset 1000, P_NOMBRES})}"

  Set RST = New ADODB.Recordset
    RST.CursorLocation = adUseClient

    RST.Open msSelect, cn
     
    Do While Not mrsSelect.EOF
         MsgBox mrsSelect.Fields(0)

         mrsSelect.MoveNext
 
     Loop

Then the ORA-06550 appears. What am I doing wrong?


You'll need more than the ORA-6550 error. This is just an informational message telling you which line in your code is causing the error. But what error is being thrown? There should be other ORA error messages, one of which will indicate your exact problem. Since this is an Oracle error message, I would suspect your package code is having the problem, not your visual basic code.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close