|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Oracle stored procedure vs. functions? is not a procedure or is undefinedSTORED 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 On 9 Jan 2007 11:23:18 -0800, "jobs" <j***@webdos.com> wrote: ¤ 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) |
|||||||||||||||||||||||