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.GetValue | OracleClient data type returned by OracleDataReader.GetOracleValue | Remarks |
---|---|---|---|
BFILE | Byte[] | OracleBFile | |
BLOB | Byte[] | OracleLob | |
CHAR | String | OracleString | |
CLOB | String | OracleLob | |
DATE | DateTime | OracleDateTime | |
FLOAT | Decimal | OracleNumber | 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 | OracleNumber | 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 | OracleMonthSpan | |
INTERVAL DAY TO SECOND | TimeSpan | OracleTimeSpan | |
LONG | String | OracleString | |
LONG RAW | Byte[] | OracleBinary | |
NCHAR | String | OracleString | |
NCLOB | String | OracleLob | |
NUMBER | Decimal | OracleNumber | Using the .NET Framework data type can cause an overflow. |
NVARCHAR2 | String | OracleString | |
RAW | Byte[] | OracleBinary | |
REF CURSOR | The Oracle REF CURSOR data type is not supported by the OracleDataReader object. | ||
ROWID | String | OracleString | |
TIMESTAMP | DateTime | OracleDateTime | |
TIMESTAMP WITH LOCAL TIME ZONE | DateTime | OracleDateTime | |
TIMESTAMP WITH TIME ZONE | DateTime | OracleDateTime | |
UNSIGNED INTEGER | Number | OracleNumber | 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 | OracleString |
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 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.