简体   繁体   中英

C# OracleDbType equivalent - for Oracle datatype char

I want to pass a single CHAR to an oracle sp.

I tried using:

cmd.Parameters.Add("i_flag", OracleDbType.Varchar2, flag, ParameterDirection.Input);

where flag is a C# char but it gives Overflow exception.

I also tried:

cmd.Parameters.Add("i_flag", OracleDbType.Char, flag, ParameterDirection.Input);

but it gives same exception.

Even the below gives the same exception:

cmd.Parameters.Add("i_flag", OracleDbType.Varchar2, flag.ToString(), ParameterDirection.Input);

Can you please tell what is the correct parameter type that I should pass.

Thanks, Varun

More analysis revealed that the overflow was due to some arithmetic operation being done in stored procedure.

We need to truncate the decimal before sending it to .NET

Something similar to https://kr.forums.oracle.com/forums/thread.jspa?threadID=231945

Thanks for all the help though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM