Solved

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

Posted on 2004-09-13
6
431 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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