Specifying Source File Locations - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

The CREATE PROCEDURE statement provides clauses that specify the name and path of the function source code file.

CREATE PROCEDURE Clause Description
EXTERNAL Use the EXTERNAL clause when the function source is in the current or default directory on the client, and no other files need to be included.

The source name is the name that immediately follows the CREATE PROCEDURE keywords.

If the client is..

  • workstation-attached, then BTEQ adds appropriate file extensions to the source name to locate the source file.
  • mainframe-attached, then the source name must be a DDNAME file name.

Here is an example:

CREATE PROCEDURE GetRegionXSP
  (INOUT region VARCHAR(64))
LANGUAGE C
NO SQL
EXTERNAL
PARAMETER STYLE TD_GENERAL;
EXTERNAL NAME 'string'
Use ' string ' to specify names and locations of the following:
  • Function source, include header files, object files, libraries, and packages on the server.
  • Function source, include header files, and object files on the client.

You can also use 'string' to specify that the source or include files not be stored.

If the client is..

  • workstation-attached, then if necessary, BTEQ adds appropriate file extensions to the names to locate the files.
  • mainframe-attached, then the names must be DDNAME file names.

Here is an example:

CREATE PROCEDURE GetRegionXSP
  (INOUT region VARCHAR(64))
LANGUAGE C
NO SQL
EXTERNAL NAME 'CS!getregion!xspsrc/getregion.c!F!xsp_getregion'
PARAMETER STYLE TD_GENERAL;

where...

  • ! in 'string' specifies a delimiter.
  • C in 'string' specifies that the source is obtained from the client.
  • S in 'string' specifies that the information between the following two sets of delimiters identifies the name and location of a C or C++ function source file.
  • getregion in 'string' specifies the name, without the file extension, that the server uses to compile the source.
  • xspsrc/getregion.c in 'string' specifies a relative path (xspsrc) for the source file (getregion.c).
  • F in 'string' specifies that the information after the next delimiter identifies the C or C++ function name.
  • xsp_getregion in 'string' specifies the C or C++ function name.
EXTERNAL NAME function_name Use EXTERNAL NAME function_name when the function source is in the current or default directory on the client, and no other files need to be included.

The source name is the same as function_name.

If the client is...

  • workstation-attached, then BTEQ adds appropriate file extensions to function_name to locate the source file.
  • mainframe-attached, then function_name must be a DDNAME file name.

Here is an example where function_name is xsp_getregion:

CREATE PROCEDURE GetRegionXSP
  (INOUT region VARCHAR(64))
LANGUAGE C
NO SQL
EXTERNAL NAME xsp_getregion
PARAMETER STYLE TD_GENERAL;

For more information on CREATE PROCEDURE and the EXTERNAL clause, see Teradata Vantageā„¢ - SQL Data Definition Language Detailed Topics, B035-1184.