17.10 - getExternalQuery - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

Generates the text query string for the foreign server and returns the interface version that is currently supported. The method returns a string which contains the external query.

This routine is callable on a PE vproc only by a table operator.

Syntax

public String  getExternalQuery(
   ColumnDefinition[]  colDefs,
   ServerType          serverType,
   ExtOpSetType[]      extOpSetTypes,
   int[]               interfaceVersions)
      throws SQLException

Syntax Elements

colDefs
A list of column definitions.
serverType
ServerType is defined as follows:
public enum ServerType {
   ANSISQL(0),
   HADOOP(1);
}
extOpSetTypes
A set of valid operators supported on the foreign server.
ExOpSetType is defined as follows:
public enum ExtOpSetType {
   Eq_ET(0),
   Ne_ET(1),
   Gt_ET(2),
   Le_ET(3),
   Lt_ET(4),
   And_ET(5),
   Or_ET(6),
   Not_ET(7),
   Between_ET(8),
   In_ET(9),
   NotIn_ET(10),
   Ge_ET(11),
   Like_ET(12),
   LastOp_ET(13);
}
interfaceVersions
  • The caller passes in the desired interface version as the argument.
  • The routine returns the actual interface version that is currently supported.

Example: Calling getExternalQuery

ServerType sType = ServerType.ANSISQL;
ExtOpSetType extOpTypes[] = new ExtOpSetType[3];
extOpTypes[0] = ExtOpSetType.Eq_ET;
extOpTypes[1] = ExtOpSetType.And_ET;
extOpTypes[2] = ExtOpSetType.Or_ET;

int[] versions = new int[2];
versions[0] = 1;    // The caller passes in the desired interface version.

String extQuery = contract.getExternalQuery(colDefs, sType, extOpTypes, versions);

After calling getExternalQuery, versions[1] will contain the actual interface version that is currently supported on the system.