R
rishaan
I am trying to call a stored function of Oracle Package from VB.net.
The function takes a string and returns boolean.
How should I call it from vb.net ?
I tried 3 different ways but get error:
ORA-06550LS-00221:StoredFunctionNAme is not a procedure or is
undefined.L/SQL:statement ignored.
I also tried "select StoredFunctionName(' " & saha & "') from
dual"
but Oracle does not allow boolean values in SQL.
the code:
Dim connection As OracleConnection = Nothing
Dim command As OracleCommand = Nothing
connection = New OracleConnection(ConnString)
command.CommandType = CommandType.StoredProcedure
Dim paraName As New OracleParameter("StoredFunctionNAme",
OracleType.VarChar)
paraName.Direction = ParameterDirection.Input
paraName.Value = Name
command.Parameters.Add(paraName)
connection.Open()
Dim MyDA As New OracleDataAdapter(command)
Dim ds As New DataSet
Try
(1) MyDA.Fill(ds)
Dim rowid As OracleString
(2) Dim bb As Boolean =
Convert.ToBoolean(command.ExecuteOracleNonQuery(rowid))
(3) Dim bb1 As Boolean =
Convert.ToBoolean(command.ExecuteNonQuery())
Catch x As Exception
MessageBox.Show(x.Message.ToString)
End Try
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
The function takes a string and returns boolean.
How should I call it from vb.net ?
I tried 3 different ways but get error:
ORA-06550LS-00221:StoredFunctionNAme is not a procedure or is
undefined.L/SQL:statement ignored.
I also tried "select StoredFunctionName(' " & saha & "') from
dual"
but Oracle does not allow boolean values in SQL.
the code:
Dim connection As OracleConnection = Nothing
Dim command As OracleCommand = Nothing
connection = New OracleConnection(ConnString)
command.CommandType = CommandType.StoredProcedure
Dim paraName As New OracleParameter("StoredFunctionNAme",
OracleType.VarChar)
paraName.Direction = ParameterDirection.Input
paraName.Value = Name
command.Parameters.Add(paraName)
connection.Open()
Dim MyDA As New OracleDataAdapter(command)
Dim ds As New DataSet
Try
(1) MyDA.Fill(ds)
Dim rowid As OracleString
(2) Dim bb As Boolean =
Convert.ToBoolean(command.ExecuteOracleNonQuery(rowid))
(3) Dim bb1 As Boolean =
Convert.ToBoolean(command.ExecuteNonQuery())
Catch x As Exception
MessageBox.Show(x.Message.ToString)
End Try
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*