Hi, I have this function placed in Oracle DB:
CREATE OR REPLACE FUNCTION CONN_LC
(APP_IN IN varchar2)
RETURN varchar
IS
Has_value varchar(256);
cursor c1 is
SELECT Myfield
FROM MyTable
WHERE Name= APP_IN;
BEGIN
open c1;
fetch c1 into Has_value;
if c1%notfound then
Has_value := 0;
else
Has_value := 1;
end if;
close c1;
RETURN Has_value;
END CONN_LC;
/
Function returns me correct results in Oracle . It checks If certain field in table is empty and returns "0" or "1".
Now my problem is that I can't get the function value from C#. This is what I tried:
cmd.CommandText = "CONN_LC";
cmb.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new OracleParameter("tt", OracleDbType.Varchar2,256,ParameterDirection.ReturnValue));
cmd.Parameters.Add(new OracleParameter("APP_IN", OracleDbType.Varchar2,combobox1.Text, ParameterDirection.Input));
cmd.ExecuteNonQuery();
string result = cmd.Parameters["tt"].Value.ToString();
if (result=="1")
{
//....
//...
}
I've tried a lot of things, but nothing get's the value form Oracle. What am I doing wrong ??
P.S.: I'm getting error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small, ORA-06512: at line 1