Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ODP.NET - VB.NET Executing a Oracle Stored Procedure passing a single param as part of the CommandTe

2629921Mar 12 2014 — edited Mar 12 2014

On a VB.NET project I have switched the db provider from the MS OLEDB for Oracle to the ODP.net and I'm getting an error executing a non query command for a stored procedure when I try to pass the param value as part of the commandtext.

I know I can make it work using cmd.parameters but on my project I don't want to parse the commandtext that historically have been passed to me with params embedded on it, and I just executed.

Is this possible? Can I keep the call of the stored procedure with params on a single string to be passed as commandtext.

Thanks.

gg

---------------------------------------------

Here is a sample VB.NET Method:

Private Sub Method()

Dim conn As New OracleConnection("Server=X;Uid=X;Pwd=X")

con.Open()

Dim cmd As OracleCommand = con.CreateCommand()

Dim myParam As String = "100"

cmd.CommandText = "test_pkg.my_func(" & myParam & ")"

cmd.CommandType = CommandType.StoredProcedure

cmd.ExecuteNonQuery()

cmd.ExecuteNonQuery()

conn.Close()

End Sub

--- The error I receive ------------------------

ORA-06550: line 1, column 7:
PLS-00801: internal error [22503]
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

--- My Stored Procedure ------------------

create or replace package test_pkg

as

  myfuncparam number(10,0);

  procedure my_func(myparam in number);

end;

CREATE OR REPLACE package body test_pkg

as

  procedure my_func(myparam in number) is

  begin

  myfuncparam := myparam;

  end;

end test_pkg;

This post has been answered by Alex Keh-Oracle on Mar 12 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2014
Added on Mar 12 2014
1 comment
819 views