Error running Oracle SP

G

Guest

Hello

The stored Procedure is

CREATE OR REPLACE PACKAGE DEPARTMENT A

TYPE CURSOR_TYPE IS REF CURSOR

PROCEDURE GET_EMPS (I_DEPTNO IN NUMBER

O_RESULT_SET IN OUT CURSOR_TYPE)

END



CREATE OR REPLACE PACKAGE BODY DEPARTMENT A

PROCEDURE GET_EMPS (I_DEPTNO IN NUMBER

O_RESULT_SET IN OUT CURSOR_TYPE

A

BEGI

OPEN O_RESULT_SET FO

select fac_no, fac_name from ams_ahrsadm.facility_table

END

END

The accessing code is

Dim oracleConn As New OracleConnection("Server=AIXHRPROD.bcps.org;Uid=ams_webuser;Pwd=amsviaweb"

Tr
oracleConn.Open(

Catch ex As Exceptio

End Tr

myCmd.Connection = oracleCon
myCmd.CommandText = "DEPARTMENT.GET_EMPS
myCmd.CommandType = CommandType.StoredProcedur
myCmd.Parameters.Add(New OracleParameter("I_DEPTNO", OracleType.Number)).Value =
myCmd.Parameters.Add(New OracleParameter("O_RESULT_SET()", OracleType.Cursor)).Direction = ParameterDirection.Outpu

Dim oDA As New OracleDataAdapter(myCmd

Tr
oDA.Fill(ds

Catch ex As Exceptio

End Tr

The error is

Referenced object has a value of 'Nothing'

All objects in my application code are not nothing

Suggestions
 
K

Kevin Yu [MSFT]

Hi mklapp,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that an exception is thrown because there is
a null reference in your code. If there is any misunderstanding, please
feel free to let me know.

I'm not quite sure about what you mean in the last post. Do you mean that
you have found the problem and had it resolved? If the problem still
persists, please feel free to let me know. I will be happy to help.

I have reviewed your code and found that the myCmd object has never been
declared an initialized in your code. I think it might be this object that
throws the exception. Please add the following line at the beginnning of
your code.

Dim myCmd as New OracleCommand

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top