Skip Headers
Oracle® Database Gateway for ODBC User's Guide
11g Release 1 (11.1)

Part Number E10311-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

A Data Type Conversion

Oracle maps the ANSI data types through ODBC interfaces to supported Oracle data types. When the results of a query are returned, Oracle converts the ODBC data types to Oracle data types.

The tables in this appendix show how Oracle maps ANSI data types through ODBC interfaces to supported Oracle data types when it is retrieving data from a non-Oracle system.

This appendix contains the following table:

A.1 Mapping ANSI Data Types to Oracle Data Types Through an ODBC Interface

The Oracle Database Gateway for ODBC maps the data types used in ODBC-compliant data sources to supported Oracle data types. When the results of a query are returned, the Oracle database converts the ODBC data types to Oracle data types. For example, the ODBC data type SQL_TIMESTAMP are converted to Oracle's DATE data type.

If a table contains a column whose data type is not supported by Oracle Database Gateway for ODBC, the column information is not returned to the Oracle database.

Table A-1 maps ODBC data types into equivalent ANSI and Oracle data types. In some cases equivalence to ANSI data types is not guaranteed to be exact because the ANSI SQL standard delegates definition of numeric precision and maximum length of character data to individual implementations. This table reflects a probable mapping between ANSI and ODBC data types for a typical implementation of ANSI SQL .

Table A-1 Mapping ANSI Data Types to Oracle Data Types Through an ODBC Interface

ANSI ODBC Oracle

NUMERIC(19,0)

SQL_BIGINT

NUMBER(19,0)

N/A

SQL_BINARY

RAW

CHAR

SQL_CHAR

CHAR

DATE

SQL_DATE

DATE

DECIMAL(p,s)

SQL_DECIMAL(p,s)

NUMBER(p,s)

DOUBLE PRECISION

SQL_DOUBLE

FLOAT(53)

FLOAT

SQL_FLOAT

FLOAT(53)

INTEGER

SQL_INTEGER

NUMBER(10)

Note: It is possible under some circumstance for the INTEGER ANSI data type to map to Precision 38, but it usually maps to Precision 10.

N/A

SQL_LONGVARBINARY

LONG RAW

N/A

SQL_LONGVARCHAR

LONG

Note: If an ANSI SQL implementation defines a large value for the maximum length of VARCHAR data, it is possible that ANSI VARCHAR will map to SQL_LONGVARCHAR and Oracle LONG. The same is true for OLE DB DBTYPE_STRING (long attribute).

REAL

SQL_REAL

FLOAT(24)

SMALLINT

SQL_SMALLINT

NUMBER(5)

TIME

SQL_TYPE_TIME

CHAR(15)

TIMESTAMP

SQL_TYPE_TIMESTAMP

DATE

NUMERIC(3,0)

SQL_TINYINT

NUMBER(3)

VARCHAR

SQL_VARCHAR

VARCHAR2

BOOLEAN

SQL_BIT

NUMBER(3)