Overall Development Synopsis | C/C++ UDMs | Teradata Vantage - 17.10 - Overall Development Synopsis - 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)

Procedure

Here is a synopsis of the steps you take to develop, compile, install, and use a UDM:

  1. Write, test, and debug the C or C++ code for the UDM.

    You can use the Teradata C/C++ UDF Debugger, which is a version of GDB (the gnu Source-Level Debugger) that contains extensions for the database. For more information, see C/C++ Command-line Debugging for UDFs.

  2. Use CREATE TYPE to create the UDT and specify constructor methods and instance methods.
    IF the method is … THEN use this METHOD specification in the CREATE TYPE statement …
    an instance method INSTANCE METHOD or METHOD
    a constructor method for a structured type CONSTRUCTOR METHOD
  3. Use CREATE METHOD or REPLACE METHOD to identify the location of the source code or object, and install it on the server.
    In general, you should not create UDMs in Teradata system databases such as SYSLIB or SYSUDTLIB. For more information, see Installing the UDM.

    The method is compiled, if the source code is submitted, linked to the dynamic linked library (DLL or SO) associated with the database in which the method resides, and distributed to all database nodes in the system.

  4. If the UDM is an instance method that provides transform, ordering, or cast functionality for a structured UDT, register the UDM as a transform, ordering, or cast routine. Otherwise, skip to the next step.
    IF the UDM implements this functionality for a UDT … THEN use this statement to register the UDM …
    cast CREATE CAST or REPLACE CAST
    ordering CREATE ORDERING or REPLACE ORDERING
    transform CREATE TRANSFORM or REPLACE TRANSFORM
  5. Test the UDM in protected execution mode until you are satisfied it works correctly.

    Protected mode is the default execution mode for a UDM. In protected mode, the database isolates all of the data the UDM might access as a separate process in its own local workspace. This makes the method run slower. If any memory violation or other system error occurs, the error is localized to the method and the transaction executing the method.

  6. Use ALTER METHOD to change the UDM to run in nonprotected execution mode.
  7. Rerun the tests from Step 5 to test the UDM in nonprotected execution mode until you are satisfied it works correctly.
  8. Use GRANT to grant privileges to users who are authorized to use the UDT.

Related Information

FOR more information on … SEE …
developing a UDM related topics in this document.
debugging a UDM Debugging a UDM.
code examples for UDMs UDM Code Examples.
  • CREATE CAST
  • CREATE METHOD
  • CREATE ORDERING
  • CREATE TRANSFORM
  • CREATE TYPE
  • REPLACE CAST
  • REPLACE METHOD
  • REPLACE ORDERING
  • REPLACE TRANSFORM
  • related topics in this document.
  • Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.