Oracle stored procedure vs. functions? is not a procedure or is undefined

J

jobs

PLS-00221: PLS-00221: is not a procedure or is undefined FUNCTIONS VS.
STORED PROCEDURES - ADO.NET TO ORACLE FUNCTION

I have a very simple oracle function I'm trying to call from ado.net.
The code works fine for a stored procedure but I get the error

PLS-00221: is not a procedure or is undefined when I try to call the
function. here's my code:

I've manually tested both the function and stored procedure and they
are both working as expected.

here's my vb.net code


Protected Overrides Sub OnLoad(ByVal e As EventArgs)

Dim cnn As OracleConnection

Dim sConnString As String = "Data Source=XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
cnn =

New OracleConnection(sConnString)

Dim cmd As New OracleCommand

With cmd
..CommandType = CommandType.StoredProcedure

..CommandText =

"FN_1" ' THIS DOES NOT WORK

'.CommandText = "SP_1" ' THIS WORKS
..CommandTimeout = 0

..Connection = cnn

..Parameters.Add(

New OracleParameter("iprocname", OracleType.VarChar)).Value = "P1"

End With
cnn.Open()


If cnn.State = ConnectionState.Open Then
Response.Write(

"connected")

End If

Dim job As String

'job = cmd.ExecuteScalar().ToString
job = cmd.ExecuteNonQuery().ToString

TextBox1.Text = job


'cmd.ExecuteNonQuery()
cmd.Dispose()

cnn.Close()


End Sub



FUNCTIONS VS. STORED PROCEDURES - ADO.NET TO ORACLE FUNCTION

I have a very simple oracle function I'm trying to call from ado.net.
The code works fine for a stored procedure but I get the error

PLS-00221: is not a procedure or is undefined when I try to call the
function. here's my code:

I've manually tested both the function and stored procedure and they
are both working as expected.

here's my vb.net code


Protected Overrides Sub OnLoad(ByVal e As EventArgs)

Dim cnn As OracleConnection

Dim sConnString As String = "Data Source=XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
cnn =

New OracleConnection(sConnString)

Dim cmd As New OracleCommand

With cmd
..CommandType = CommandType.StoredProcedure

..CommandText =

"FN_1" ' THIS DOES NOT WORK

'.CommandText = "SP_1" ' THIS WORKS
..CommandTimeout = 0

..Connection = cnn

..Parameters.Add(

New OracleParameter("iprocname", OracleType.VarChar)).Value = "P1"

End With
cnn.Open()


If cnn.State = ConnectionState.Open Then
Response.Write(

"connected")

End If

Dim job As String

'job = cmd.ExecuteScalar().ToString
job = cmd.ExecuteNonQuery().ToString

TextBox1.Text = job


'cmd.ExecuteNonQuery()
cmd.Dispose()

cnn.Close()


End Sub
 
P

Paul Clement

¤ PLS-00221: PLS-00221: is not a procedure or is undefined FUNCTIONS VS.
¤ STORED PROCEDURES - ADO.NET TO ORACLE FUNCTION
¤
¤ I have a very simple oracle function I'm trying to call from ado.net.
¤ The code works fine for a stored procedure but I get the error
¤
¤ PLS-00221: is not a procedure or is undefined when I try to call the
¤ function. here's my code:
¤
¤ I've manually tested both the function and stored procedure and they
¤ are both working as expected.
¤

See if the following newsgroup thread helps:

http://tinyurl.com/y8hrhe


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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