Mapping Data Types
The following table lists Oracle data types and their mappings to the OracleDataReader.
Oracle data type | .NET Framework data type returned by OracleDataReader.GetValue | OracleClient data type returned by OracleDataReader.GetOracleValue | Remarks |
---|---|---|---|
BFILE |
Byte[] |
|
|
BLOB |
Byte[] |
|
|
CHAR |
String |
|
|
CLOB |
String |
|
|
DATE |
DateTime |
|
|
FLOAT |
Decimal |
This 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. |
|
INTEGER |
Decimal |
This 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 MONTH |
Int32 |
|
|
INTERVAL DAY TO SECOND |
TimeSpan |
|
|
LONG |
String |
|
|
LONG RAW |
Byte[] |
|
|
NCHAR |
String |
|
|
NCLOB |
String |
|
|
NUMBER |
Decimal |
Using the .NET Framework data type can cause an overflow. |
|
NVARCHAR2 |
String |
|
|
RAW |
Byte[] |
|
|
REF CURSOR |
|
|
The Oracle REF CURSOR data type is not supported by the OracleDataReader object. |
ROWID |
String |
|
|
TIMESTAMP |
DateTime |
|
|
TIMESTAMP WITH LOCAL TIME ZONE |
DateTime |
|
|
TIMESTAMP WITH TIME ZONE |
DateTime |
|
|
UNSIGNED INTEGER |
Number |
This 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. |
|
VARCHAR2 |
String |
|
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 type | DbType enumeration to bind as a parameter | OracleType enumeration to bind as a parameter | Remarks |
---|---|---|---|
BFILE |
|
BFile |
Oracle 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. |
BLOB |
|
Blob |
Oracle 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. |
CHAR |
AnsiStringFixedLength |
Char |
|
CLOB |
|
Clob |
Oracle 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. |
DATE |
DateTime |
DateTime |
|
FLOAT |
Single, Double, Decimal |
Float, Double, Number |
Size determines the System.Data.DBType and OracleType. |
INTEGER |
SByte, Int16, Int32, Int64, Decimal |
SByte, Int16, Int32, Number |
Size determines the System.Data.DBType and OracleType. |
INTERVAL YEAR TO MONTH |
Int32 |
IntervalYearToMonth |
OracleType is only available when using both Oracle 9i client and server software. |
INTERVAL DAY TO SECOND |
Object |
IntervalDayToSecond |
OracleType is only available when using both Oracle 9i client and server software. |
LONG |
AnsiString |
LongVarChar |
|
LONG RAW |
Binary |
LongRaw |
|
NCHAR |
StringFixedLength |
NChar |
|
NCLOB |
|
NClob |
Oracle 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. |
NUMBER |
VarNumeric |
Number |
|
NVARCHAR2 |
String |
NVarChar |
|
RAW |
Binary |
Raw |
|
REF CURSOR |
|
Cursor |
For more information, see Working with Oracle REF CURSORs. |
ROWID |
AnsiString |
Rowid |
|
TIMESTAMP |
DateTime |
Timestamp |
OracleType is only available when using both Oracle 9i client and server software. |
TIMESTAMP WITH LOCAL TIME ZONE |
DateTime |
TimestampLocal |
OracleType is only available when using both Oracle 9i client and server software. |
TIMESTAMP WITH TIME ZONE |
DateTime |
TimestampWithTz |
OracleType is only available when using both Oracle 9i client and server software. |
UNSIGNED INTEGER |
Byte, UInt16, UInt32, UInt64, Decimal |
Byte, UInt16, Uint32, Number |
Size determines the System.Data.DBType and OracleType. |
VARCHAR2 |
AnsiString |
VarChar |
|
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.