C#和Oracle Number数据类型 [英] C# and the Oracle Number Datatype

查看:354
本文介绍了C#和Oracle Number数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Oracle数据库读取一个值,并且该字段已声明为Number(38).由于十进制类型不够大,我该如何在C#中做到这一点?

I need to read a value from an Oracle database and the field has been declared as Number(38). How can I do this in C# since the Decimal type isn't big enough?

推荐答案

您可以在数据读取器上调用GetString(ordinal),并将结果提供给System.Numerics.BigInteger.TryParse().

You could call GetString(ordinal) on the data reader, and feed the result to System.Numerics.BigInteger.TryParse().

或者您可以将值保留在OracleDecimal数据类型中,就像从ODP.NET接收到的那样. OracleDecimal具有几乎所有功能,包括数学: MulitplyRoundExp等.

Or perhaps you could leave the value in the OracleDecimal datatype, like you received it from ODP.NET. OracleDecimal has functions for almost everything, including math: Mulitply, Round, Exp, and so on.

这篇关于C#和Oracle Number数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆