Oracle Data Type Mappings

 

The following table shows the inferred .NET Framework type for data types for the .NET Framework Data Provider for Oracle (System.Data.OracleClient). The typed accessor methods for the OracleDataReader are also listed.

Oracle type.NET Framework type.NET Framework typed accessorOracleType typed accessor
BFILEByte[]GetBytes()GetOracleBFile()
BLOBByte[]GetBytes()GetOracleLob()
CHARString

Char[]
GetString()

GetChars()
GetOracleString()
CLOBString

Char[]
GetString()

GetChars()
GetOracleLob()
DATEDateTimeGetDateTime()GetOracleDateTime()
FLOATDecimalGetDecimal()GetOracleNumber() **
INTEGERDecimalGetDecimal()GetOracleNumber() **
INTERVAL YEAR TO MONTH *Int32GetInt32()GetOracleMonthSpan()
INTERVAL DAY TO SECOND *TimeSpanGetTimeSpan()GetOracleTimeSpan()
LONGString

Char[]
GetString()

GetChars()
GetOracleString()
LONG RAWByte[]GetBytes()GetOracleBinary()
NCHARString

Char[]
GetString()

GetChars()
GetOracleString()
NCLOBString

Char[]
GetString()

GetChars()
GetOracleLob()
NUMBERDecimalGetDecimal()GetOracleNumber() **
NVARCHAR2String

Char[]
GetString()

GetChars()
GetOracleString()
RAWByte[]GetBytes()GetOracleBinary()
REF CURSOR
ROWIDString

Char[]
GetString()

GetChars()
GetOracleString()
TIMESTAMP *DateTimeGetDateTime()GetOracleDateTime()
TIMESTAMP WITH LOCAL TIME ZONE *DateTimeGetDateTime()GetOracleDateTime()
TIMESTAMP WITH TIME ZONE *DateTimeGetDateTime()GetOracleDateTime()
UNSIGNED INTEGERDecimalGetDecimal()GetOracleNumber() **
VARCHAR2String

Char[]
GetString()

GetChars()
GetOracleString()

* The specified Oracle type is only available when you use Oracle 9i software for both the client and the server.

** An Oracle NUMBER can have a maximum of 38 significant digits. The .NET Framework decimal type is limited to 28 digits. Reading an Oracle NUMBER into a .NET Framework decimal type causes an OverflowException for NUMBER values that exceed 28 digits. If you are reading an Oracle NUMBER value from an OracleDataReader, we recommend that you call the GetOracleNumber typed accessor method to return Oracle NUMBER values as an OracleNumber. If you are filling a DataSet, you can use the FillError event to determine whether an OverflowException has occurred, and to take appropriate action if so. For information about the FillError event, see Handling DataAdapter Events.

Oracle and ADO.NET
Retrieving and Modifying Data in ADO.NET
ADO.NET Managed Providers and DataSet Developer Center

Show: