Share via


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

Question

Tuesday, January 9, 2007 11:58 AM

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

All replies (1)

Tuesday, January 9, 2007 6:23 PM

I figured it out. I needed to specify param direction.