Pregunta

When i use old Oracle Dll in my .net mvc project it works:

   cmd.CommandText = "dba.user_login";
   cmd.CommandType = CommandType.StoredProcedure;
   cmd.Parameters.Add("KUL", OracleType.VarChar).Value = userName;
   cmd.Parameters.Add("SIFRE", OracleType.VarChar).Value = pass;
   cmd.Parameters.Add("FLAG", OracleType.Float).Value = 1;
   cmd.Parameters.Add("HATA", OracleType.VarChar).Value = "error";
   cmd.Parameters.Add("result", OracleType.Float).Direction = ParameterDirection.ReturnValue;

But i want to use new oracle .net provider because of old oracle dll deprecated. i tried this :

   cmd.CommandText = "dba.user_login";
   cmd.CommandType = CommandType.StoredProcedure;
   cmd.Parameters.Add("KUL", OracleDbType.Varchar2).Value = userName;
   cmd.Parameters.Add("SIFRE", OracleDbType.Varchar2).Value = pass;
   cmd.Parameters.Add("FLAG", OracleDbType.Single).Value = 1;
   cmd.Parameters.Add("HATA", OracleDbType.Varchar2).Value = "error";
   cmd.Parameters.Add("result", OracleDbType.Single).Direction = ParameterDirection.ReturnValue;

But it not works. Exception: ORA-06502: PL/SQL: numeric or value error: character to number conversion error\nORA-06512: at line 1 Can anybody help me to fix this. Thank you.

¿Fue útil?

Solución

Fantastic, that one design decision always leads to issues at the start of using it (and occassionally down the road!)

Since this answered your question I'll 'promote' my comment to an answer (if that isn't proper let me know and I'll delete this answer)

Keep in mind that ODP.net binds by position by default (a break from the default System.Data.Ora does) -- you may use

BindByName = true 

to force the command object to behave the same

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top