DB Access Module for Oracle OCI User’s Guide : Chapter 2 Technical Information : Datatypes
Datatypes
The classes RWDBColumn and RWDBValue have an associated RWDBValue::ValueType that specifies the datatype of the database column or field being referenced. Mapping between this datatype and the database vendor type runs in both directions:
When fetching data or retrieving information about tables, the DB Access Module for Oracle OCI converts the Oracle-specific datatype information provided by the database into RWDBValue::ValueTypes. This mapping is shown in Table 1, which also gives the C++ datatype corresponding to the RWDBValue::ValueType.
When creating tables, the DB Access Module for Oracle OCI maps the given RWDBValue::ValueType into an Oracle-specific type. This mapping is shown in Table 2.
The RWDBValue::ValueTypes, accessible through the type() method, are uniform across all Access Modules. For a complete explanation of the DB Interface Module data model, see Chapter 7, “The Data Model,” in the DB Interface Module User’s Guide, and RWDBValue in the SourcePro API Reference Guide.
Table 1 – Type mapping when retrieving data
Oracle Datatype
RWDBValue::ValueType
C++ Datatype
CHAR(n)
VARCHAR2(n)
String
NCHAR(n)
NVARCHAR2(n)
UString
LONG
String
CLOB
String
RAW(n)
LONG RAW
Blob
BLOB
Blob
NUMBER(p,0) 0 < p < 101
Long
long int
NUMBER(p,0) 10 <= p < 191
LongLong
long long
NUMBER(p,0) p >= 19
Decimal
NUMBER(p,s) 0 < p < 101
Double
double
NUMBER(p,s) p >= 10
Decimal
NUMBER
Decimal
FLOAT(p)
Double
double
BINARY_FLOAT
Float
float
BINARY_DOUBLE
Double
double
DATE2
DateTime
ROWID
String
MLSLABEL
String
TIMESTAMP2,3
DateTime

1 For Stored Procedures, due to lack of precision and scale information, the NUMBER column is mapped to RWDecimalPortable

2 Values of type DATE and TIMESTAMP are affected by the time zone setting on either RWDBDatabase or RWDBConnection while sending and retrieving data. The time zone setting can be set programmatically with the timeZone() method in each of these classes.

3 The datatypes TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE are not supported.

Table 2 – Type mapping when creating tables 
RWDBValue::ValueType
Oracle Datatype
Blob
BLOB, if nativeType of the RWDBColumn is SQLT_BLOB
RAW(n), using the storageLength of the RWDBColumn for value n, if 0 < storageLength <= 2000
LONG RAW otherwise
Char
UnsignedChar
NUMBER(d), where d is the number of digits needed to store the maximum value a char can express on the client machine
Date
DATE
DateTime
DATE if useTimestamp() is false1
TIMESTAMP(p), using precision of RWDBColumn, if useTimestamp() is true and precision is specified
TIMESTAMP otherwise
Decimal
NUMBER(p,s), using precision and scale of RWDBColumn if precision is specified
NUMBER otherwise
Double
FLOAT(126)
Duration
Not supported by DB Access Module for Oracle OCI.
Float
FLOAT(p) using precision of RWDBColumn, if specified.
FLOAT otherwise
Int
UnsignedInt
NUMBER(d), where d is the number of digits needed to store the maximum value an int can express on the client machine
Long
UnsignedLong
NUMBER(d), where d is the number of digits needed to store the maximum value a long can express on the client machine
LongLong
UnsignedLongLong
NUMBER(d) where d is the number of digits needed to store the maximum value a long long can express on the client machine
MBString
UString
WString
NVARCHAR2(n) using the storageLength of the RWDBColumn, if specified
NVARCHAR2(2000) otherwise
Short
UnsignedShort
Tiny
UnsignedTiny
NUMBER(d), where d is the number of digits needed to store the maximum value a short can express on the client machine
String
CLOB, if nativeType of the RWDBColumn is SQLT_CLOB
VARCHAR2(n), using the storageLength of the RWDBColumn, if 0 < storageLength <= 4000
LONG otherwise
NoType
If nativeType of the RWDBColumn is:
SQLT_NUM, then NUMBER(p,s), using precision and scale of the RWDBColumn
SQLT_RDD, then ROWID
SQLT_BFLOAT or SQLT_IBFLOAT, then BINARY_FLOAT
SQLT_BDOUBLE or SQLT_IBDOUBLE, then BINARY_DOUBLE

1 To switch between the DATE and TIMESTAMP data mappings, use the useTimestamp() method of the custom environmental handle class RWDBOCIEnvironmentHandle.

Restrictions on the Use of Datatypes
Oracle servers place restrictions on the use of certain datatypes. Where possible, the DB Interface Module is flexible about datatypes. However, there are situations where conversions are not possible, and in these cases your application must be aware of the contexts in which certain datatypes can be used. Table 3 outlines the restrictions associated with each DB Interface Module type.
Table 3 – Restrictions on the use of DB Interface Module datatypes 
RWDBValue::ValueType
Restrictions
Blob
No restrictions
Char
UnsignedChar
No restrictions
Date
No restrictions
DateTime
Oracle's TIMESTAMP datatype supports dates from January 1, 4712 BC through December 31, 9999, 23:59:59.999, but RWDateTime is limited to dates since September, 14, 1752.
Further, Oracle’s TIMESTAMP datatype can hold fractional seconds with a precision of 0 through 9, but RWDateTime is limited to milliseconds.
TimeTuple
No restrictions
TimeTupleOffset
Not supported
Decimal
No restrictions
Double
No restrictions
Duration
Not supported by DB Access Module for Oracle OCI
Float
No restrictions
Int
UnsignedInt
No restrictions
Long
UnsignedLong
No restrictions
LongLong
UnsignedLongLong
No restrictions
MBString
UString
WString
Limited to 4,000 bytes
LongDouble
No restrictions
Short
UnsignedShort
No restrictions
String
No restrictions