Oracle Data Type Mappings

 

The following table lists Oracle data types and their mappings to the OracleDataReader.

Oracle data type.NET Framework data type returned by OracleDataReader.GetValueOracleClient data type returned by OracleDataReader.GetOracleValueRemarks
BFILEByte[]OracleBFile
BLOBByte[]OracleLob
CHARStringOracleString
CLOBStringOracleLob
DATEDateTimeOracleDateTime
FLOATDecimalOracleNumberThis data type is an alias for the NUMBER data type, and is designed so that the OracleDataReader returns a System.Decimal or OracleNumber instead of a floating-point value. Using the .NET Framework data type can cause an overflow.
INTEGERDecimalOracleNumberThis data type is an alias for the NUMBER(38) data type, and is designed so that the OracleDataReader returns a System.Decimal or OracleNumber instead of an integer value. Using the .NET Framework data type can cause an overflow.
INTERVAL YEAR TO MONTHInt32OracleMonthSpan
INTERVAL DAY TO SECONDTimeSpanOracleTimeSpan
LONGStringOracleString
LONG RAWByte[]OracleBinary
NCHARStringOracleString
NCLOBStringOracleLob
NUMBERDecimalOracleNumberUsing the .NET Framework data type can cause an overflow.
NVARCHAR2StringOracleString
RAWByte[]OracleBinary
REF CURSORThe Oracle REF CURSOR data type is not supported by the OracleDataReader object.
ROWIDStringOracleString
TIMESTAMPDateTimeOracleDateTime
TIMESTAMP WITH LOCAL TIME ZONEDateTimeOracleDateTime
TIMESTAMP WITH TIME ZONEDateTimeOracleDateTime
UNSIGNED INTEGERNumberOracleNumberThis data type is an alias for the NUMBER(38) data type, and is designed so that the OracleDataReader returns a System.Decimal or OracleNumber instead of an unsigned integer value. Using the .NET Framework data type can cause an overflow.
VARCHAR2StringOracleString

The following table lists Oracle data types and the .NET Framework data types (System.Data.DbType and OracleType) to use when binding them as parameters.

Oracle data typeDbType enumeration to bind as a parameterOracleType enumeration to bind as a parameterRemarks
BFILEBFileOracle only allows binding a BFILE as a BFILE parameter. The .NET Data Provider for Oracle does not automatically construct one for you if you attempt to bind a non-BFILE value, such as byte[] or OracleBinary.
BLOBBlobOracle only allows binding a BLOB as a BLOB parameter. The .NET Data Provider for Oracle does not automatically construct one for you if you attempt to bind a non-BLOB value, such as byte[] or OracleBinary.
CHARAnsiStringFixedLengthChar
CLOBClobOracle only allows binding a CLOB as a CLOB parameter. The .NET Data Provider for Oracle does not automatically construct one for you if you attempt to bind a non-CLOB value, such as System.String or OracleString.
DATEDateTimeDateTime
FLOATSingle, Double, DecimalFloat, Double, NumberSize determines the System.Data.DBType and OracleType.
INTEGERSByte, Int16, Int32, Int64, DecimalSByte, Int16, Int32, NumberSize determines the System.Data.DBType and OracleType.
INTERVAL YEAR TO MONTHInt32IntervalYearToMonthOracleType is only available when using both Oracle 9i client and server software.
INTERVAL DAY TO SECONDObjectIntervalDayToSecondOracleType is only available when using both Oracle 9i client and server software.
LONGAnsiStringLongVarChar
LONG RAWBinaryLongRaw
NCHARStringFixedLengthNChar
NCLOBNClobOracle only allows binding a NCLOB as a NCLOB parameter. The .NET Data Provider for Oracle does not automatically construct one for you if you attempt to bind a non-NCLOB value, such as System.String or OracleString.
NUMBERVarNumericNumber
NVARCHAR2StringNVarChar
RAWBinaryRaw
REF CURSORCursorFor more information, see Oracle REF CURSORs.
ROWIDAnsiStringRowid
TIMESTAMPDateTimeTimestampOracleType is only available when using both Oracle 9i client and server software.
TIMESTAMP WITH LOCAL TIME ZONEDateTimeTimestampLocalOracleType is only available when using both Oracle 9i client and server software.
TIMESTAMP WITH TIME ZONEDateTimeTimestampWithTzOracleType is only available when using both Oracle 9i client and server software.
UNSIGNED INTEGERByte, UInt16, UInt32, UInt64, DecimalByte, UInt16, Uint32, NumberSize determines the System.Data.DBType and OracleType.
VARCHAR2AnsiStringVarChar

The InputOutput, Output, and ReturnValue ParameterDirection values used by the Value property of the OracleParameter object are .NET Framework data types, unless the input value is an Oracle data type (for example, OracleNumber or OracleString). This does not apply to REF CURSOR, BFILE, or LOB data types.

Oracle and ADO.NET
ADO.NET Managed Providers and DataSet Developer Center

Show: