CREATE FOREIGN TABLE seq (nextval integer OPTIONS (NAMEINSOURCE 'seq.nextval'), currval integer options (NAMEINSOURCE 'seq.currval') ) OPTIONS (NAMEINSOURCE 'DUAL')
Oracle translator (oracle)
Also see common JDBC translators information.
The Oracle translator, known by the type name oracle, is for use with Oracle Database 9i or later.
Note
|
The Oracle-provided JDBC driver uses large amounts of memory. Because the driver caches a high volume of data in the buffer, problems can occur on computers that lack sufficient memory allocation. For more information, see the following resources: |
- useGeometryType
-
Use the Teiid Geometry type when importing columns with a source type of SDO_GEOMETRY. Defaults to false.
NoteMetadata import from Oracle may be slow. It is recommended that at least a schema name filter is specified. There is also the useFetchSizeWithLongColumn=true
connection property that can increase the fetch size for metadata queries. It significantly improves the metadata load process, especially when there are a large number of tables in a schema.
- OracleSuppliedDriver
-
Indicates that the Oracle supplied driver (typically prefixed by ojdbc) is being used. Defaults to true. Set to
false
when using DataDirect or other Oracle JDBC drivers.
- Sequences
-
You can use sequences with the Oracle translator. You can model a sequence as a table with a name in source of DUAL, and setting column names in the source set to
<sequence name>.[nextval|currval]
With Teiid 10.0+, you can import sequences automatically.
For more information, see Importer properties in JDBC translators. Teiid 8.4 and Prior Oracle Sequence DDL
With Teiid 8.5 it’s no longer necessary to rely on a table representation and Oracle-specific handling for sequences.
For information about representing currval
and nextval
as source functions,
see DDL metadata for schema objects
CREATE FOREIGN FUNCTION seq_nextval () returns integer OPTIONS ("teiid_rel:native-query" 'seq.nextval');
You can also use a sequence as the default value for insert columns by setting the column to autoincrement,
and setting the name in source to <element name>:SEQUENCE=<sequence name>.<sequence value>
.
A rownum column can also added to any Oracle physical table to support the rownum pseudo-column.
A rownum column should have a name in source of rownum
.
These rownum columns do not have the same semantics as the Oracle rownum construct so care must be taken in their usage.
Out parameters for procedures may also be used to return a result set, if this is not represented correctly by the automatic
import you need to manually create a result set and represent the output parameter with native type REF CURSOR
.
create foreign procedure proc (in x integer, out y object options (native_type 'REF CURSOR'))
returns table (a integer, b string)
The Oracle translator supports the following geospatial functions:
- Relate = sdo_relate
CREATE FOREIGN FUNCTION sdo_relate (arg1 string, arg2 string, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_relate (arg1 Object, arg2 Object, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_relate (arg1 string, arg2 Object, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_relate (arg1 Object, arg2 string, arg3 string) RETURNS string;
- Nearest_Neighbor = sdo_nn
CREATE FOREIGN FUNCTION sdo_nn (arg1 string, arg2 Object, arg3 string, arg4 integer) RETURNS string;
CREATE FOREIGN FUNCTION sdo_nn (arg1 Object, arg2 Object, arg3 string, arg4 integer) RETURNS string;
CREATE FOREIGN FUNCTION sdo_nn (arg1 Object, arg2 string, arg3 string, arg4 integer) RETURNS string;
- Within_Distance = sdo_within_distance
CREATE FOREIGN FUNCTION sdo_within_distance (arg1 Object, arg2 Object, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_within_distance (arg1 string, arg2 Object, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_within_distance (arg1 Object, arg2 string, arg3 string) RETURNS string;
- Nearest_Neigher_Distance = sdo_nn_distance
CREATE FOREIGN FUNCTION sdo_nn_distance (arg integer) RETURNS integer;
- Filter = sdo_filter
CREATE FOREIGN FUNCTION sdo_filter (arg1 Object, arg2 string, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_filter (arg1 Object, arg2 Object, arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_filter (arg1 string, arg2 object, arg3 string) RETURNS string;
Depending on the Oracle version, the Oracle translator, registers the following non-geospatial pushdown functions with the engine:
- TRUNC
-
Both numeric and timestamp versions.
- LISTAGG
-
Requires the Teiid SQL syntax "LISTAGG(arg [, delim] ORDER BY …)"
If you need to retrieve SQLXML values from Oracle and are getting oracle.xdb.XMLType or OPAQUE instances instead, you make the following changes:
-
Use client driver version 11, or later.
-
Place the
xdb.jar
andxmlparserv2.jar
files in the classpath. -
Set the system property
oracle.jdbc.getObjectReturnsXMLType="false"
.For more information, see the Oracle documentation.