Oracle Data Type Mappings (ADO.NET)

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 accessor

OracleType typed accessor

BFILE

Byte[]

GetBytes()

GetOracleBFile()

BLOB

Byte[]

GetBytes()

GetOracleLob()

CHAR

String

Char[]

GetString()

GetChars()

GetOracleString()

CLOB

String

Char[]

GetString()

GetChars()

GetOracleLob()

DATE

DateTime

GetDateTime()

GetOracleDateTime()

FLOAT

Decimal

GetDecimal()

GetOracleNumber() **

INTEGER

Decimal

GetDecimal()

GetOracleNumber() **

INTERVAL YEAR TO MONTH *

Int32

GetInt32()

GetOracleMonthSpan()

INTERVAL DAY TO SECOND *

TimeSpan

GetTimeSpan()

GetOracleTimeSpan()

LONG

String

Char[]

GetString()

GetChars()

GetOracleString()

LONG RAW

Byte[]

GetBytes()

GetOracleBinary()

NCHAR

String

Char[]

GetString()

GetChars()

GetOracleString()

NCLOB

String

Char[]

GetString()

GetChars()

GetOracleLob()

NUMBER

Decimal

GetDecimal()

GetOracleNumber() **

NVARCHAR2

String

Char[]

GetString()

GetChars()

GetOracleString()

RAW

Byte[]

GetBytes()

GetOracleBinary()

REF CURSOR

 

 

 

ROWID

String

Char[]

GetString()

GetChars()

GetOracleString()

TIMESTAMP *

DateTime

GetDateTime()

GetOracleDateTime()

TIMESTAMP WITH LOCAL TIME ZONE *

DateTime

GetDateTime()

GetOracleDateTime()

TIMESTAMP WITH TIME ZONE *

DateTime

GetDateTime()

GetOracleDateTime()

UNSIGNED INTEGER

Decimal

GetDecimal()

GetOracleNumber() **

VARCHAR2

String

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 (ADO.NET).

See Also

Other Resources

Oracle and ADO.NET

Retrieving and Modifying Data in ADO.NET

ADO.NET Managed Providers and DataSet Developer Center