Solved

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

Posted on 2004-09-13
6
438 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
send messages to whatsapp programatically 2 62
Show/Hide ASP.NET controls with JQuery best practices 3 90
VB.Net - TypeInitializer Error 25 32
Optimize the query 5 43
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

856 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