7 The Oracle Data Provider : Data Types

Data Types
Table 7-2 through Table 7-5 list the data types supported by the Oracle data provider:
Table 7-2 maps the Oracle data types to the .NET Framework types.
Table 7-3 maps the data types the data provider uses if only the System.Data.DbType is specified.
Table 7-4 maps the data types the data provider uses to infer a data type if the provider-specific type and the System.Data.DbType are not provided.
Table 7-5 maps the data types the data provider uses when streams are used as inputs to Long data parameters.
Mapping Oracle Data Types to .NET Framework Data Types
Table 7-2 lists the data types supported by the Oracle data provider and how they are mapped to the .NET Framework types. You can use the table to infer the data types that will be used when a DataSet is filled using a DataAdapter. This table also identifies the accessors to use for accessing the data when a DataReader object is used directly.
In this table, the columns are defined as follows:
 

1
Only supported on Oracle 10g and higher.

2
The Oracle documentation strongly discourages the use of the Long and Long Raw data types.

3
Only supported on Oracle 9i and higher.

Mapping Parameter Data Types
The type of the parameter is specific to each data provider. The Oracle data provider must convert the parameter value to a native format before sending it to the server. The best way for an application to describe a parameter is to use the data provider-specific type enumeration.
In generic programming circumstances, the data provider-specific type may not be available. When no provider-specific DbType has been specified, the data type will be inferred from either the System.Data.DbType or from the .NET Framework type of the parameter’s value.
The Oracle data provider uses the following order when inferring the data type of a parameter:
Table 7-3 shows how Oracle infers its types if only the System.Data.DbType is specified.

1
Maps to Date for Oracle 8i.

Table 7-4 shows the mapping that the data provider uses to infer a data type if neither the provider-specific data type nor the System.Data.DbType are provided.

1
Byte array size must be less than 4000. For byte arrays greater than 4000, explicitly set the OracleDbType.

2
Strings greater than 4000 characters are not allowed. For Strings greater than 4000 characters, explicitly set the OracleDbType.

Data Types Supported With Stream Objects
Table 7-5 shows the data types with which the Oracle data provider supports the use of streams as inputs to long data parameters.
See “Using Streams as Input to Long Data Parameters” for a discussion of using streams.