17.10 - Example: Distributing a Package - 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)

Here is an example of how to distribute version 1.0 of a package called libcstd2.so to all nodes. In this example, the target server directory is /Teradata/dem/udfs and there is a .so file on the Windows client:

LobTeq -- Enter your DBC/SQL request or LobTeq command:
.using 'libcstd2.so'xfile

*** .using accepted

LobTeq -- Enter your DBC/SQL request or LobTeq command:
USING (a BLOB AS DEFERRED)
CALL SYSLIB.installsp('cstdlib2', '1.0', 'libcstd2.so', 'udfs',
   :a, 'CREATE', pform, cfgpath);

Sending LOB data, chunk 1
*** Procedure has been executed.

LINUX64               /Teradata/dem/udfs/

Here is an example of a CREATE FUNCTION statement that creates the function from the installed package.

CREATE FUNCTION SYSLIB.cSTD_DEV(x FLOAT)
RETURNS FLOAT
CLASS AGGREGATE
LANGUAGE C
NO SQL
PARAMETER STYLE SQL
EXTERNAL NAME 'SP!/Teradata/dem/udfs/libcstd2.so';

Note that the filename and path specified in the EXTERNAL NAME clause are the same as the filename IN argument and cfgpath OUT argument in the call to installsp.