Specifying Files for User-Defined Functions - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

When a programming task cannot be accomplished with SQL’s built-in functions, optional solutions include writing a user-defined function in standard C, C++, or Java programming languages to extend a set of available functions.

The C, C++, or Java files can reside on the server or the client. The server calls for the transfer of client-resident files as needed for input requirements for the CREATE or REPLACEFUNCTION request. Source files must be encoded as ASCII (workstation) or EBCDIC (mainframe), regardless of the current session character set. Note, the same transfer protocol is employed when using client-resident files to create user-defined methods (UDMs) and external stored procedures (XSPs).

Note: Starting with DBS 13.10 and BTEQ 13.10, the encoding expected for file name values is based on session character set rather than solely on the platform-appropriate single-byte character sets of ASCII or EBCDIC. This means that, for Unicode® sessions only, the transfer protocol is not forward- or backward-compatible when a 13.10 version of either DBS or BTEQ is used with an older version of the other.

Workstation BTEQ

If workstation BTEQ cannot locate a file based on the name requested by the database, it appends an extension to the name and searches for the file based on the extended name. The extension is derived from information from the Teradata Database about the associated source language and file type. Workstation BTEQ derives extensions for the following file types:

  • .c
  • .cpp
  • .h
  • .o (when using BTEQ on a UNIX OS)
  • .obj (when using Windows BTEQ)
  • Mainframe BTEQ

    Mainframe BTEQ only accepts DDNAMES in the EXTERNAL clause of the CREATE FUNCTION statement. Therefore, it does not derive file types for file names.

    Transferring Source or Include Files Using Mainframe BTEQ

    When transferring source or include files using mainframe BTEQ, the record gaps that delineate end-of-line are replaced by BTEQ with carriage returns so they can be mapped to meaningful code points by the database. No other changes are required for these files. Files of other types are transferred without modification.

    The full specification of the syntax, format, and rules for both creating and invoking UDFs is beyond the scope of this document. See SQL External Routine Programming for details on how to create and invoke user-defined functions.