Solved

How to execute and see results of Oracle Stored Procedure from VB.NET

Posted on 2004-09-13
6
415 Views
Last Modified: 2012-08-14
I created a simple SP in oracle like this:
 create or replace procedure TEST_VM(prm_1 IN varchar2,prm_2 IN varchar2,sp_cursor OUT sys_refcursor
)
 is
 begin
 open sp_cursor for select * from nm_Test where ptcpt_cd = prm_1 and ptcpt_nme = prm_2;
 end;
 /

It created and I can run in sql*plus perfectly and I have this code in VB.NET and I'm not able to run the procedure
myCMD.CommandText = "TEST_VJ"
        myCMD.CommandType = System.Data.CommandType.StoredProcedure
 
myCMD.Parameters.Add(New OracleParameter("prm_1", OracleType.VarChar)).Value = "'PARENT'"
        myCMD.Parameters.Add(New OracleParameter("prm_2", OracleType.VarChar)).Value = "'PARENT'"
        myCMD.Parameters.Add(New OracleParameter("sys_refcursor", OracleType.Cursor)).Direction = ParameterDirection.Output

myCMD.ExecuteNonQuery()

What is wrong am I doing

Since I don't have many points that I'm giving only 30 points right now.
Thanks
vm
0
Comment
Question by:vmandem
  • 3
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
natloz earned 30 total points
ID: 12049021
does it run if you comment out this line?
 
myCMD.Parameters.Add(New OracleParameter("sys_refcursor", OracleType.Cursor)).Direction = ParameterDirection.Output
0
 
LVL 7

Expert Comment

by:natloz
ID: 12049024
You should not have to pass in a return value as far as I know...
0
 
LVL 7

Expert Comment

by:natloz
ID: 12049054
Hold the phone...you may need it actually...are you getting an error?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 10

Expert Comment

by:123654789987
ID: 12051389
Try changing it to

myCMD.Parameters.Add(New OracleParameter("@prm_1", OracleType.VarChar)).Value = "'PARENT'"
myCMD.Parameters.Add(New OracleParameter("@prm_2", OracleType.VarChar)).Value = "'PARENT'"
        myCMD.Parameters.Add(New OracleParameter("@sys_refcursor", OracleType.Cursor)).Direction = ParameterDirection.Output
0
 

Author Comment

by:vmandem
ID: 12054235
natloz

I get the error as:
ORA-06550: line1, column7;
PLS-00306: wrong number or types of arguments
ORA-06550: line1, column7;
PL/SQL: Statment ignored
0
 

Author Comment

by:vmandem
ID: 12054257
123654...

I get this error if I use @:

ORA-01036: illegal variable name/number.

I don't know where excatly it is doing. Can you tell me based on my stored procedure where it is causing.

Thanks
vm
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now