Overall Procedure | Debugging Using Trace Tables | Teradata Vantage - Overall Procedure - 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ā„¢

Here is a synopsis of the steps you take to debug scalar, aggregate, and table functions using trace tables.

You can also use this procedure to debug external stored procedures.
  1. Create a trace table using the CREATE GLOBAL TEMPORARY TRACE TABLE statement.

    The first two columns of the trace table are used by the Teradata function trace subsystem. Any columns that are defined beyond the first two are available for a UDF to use to write trace output during execution.

  2. Enable the trace table for function trace output using the SET SESSION FUNCTION TRACE statement.

    You can specify an optional function trace string that the UDF can obtain during execution.

  3. Invoke the function.
  4. Call FNC_Trace_String in the UDF to get the function trace string that was specified in the SET SESSION FUNCTION TRACE statement.

    You can use the value of the trace string to determine what to output to the trace table.

  5. Call FNC_Trace_Write_DL to write trace output to the columns of a trace table.

    -OR-

    If you are debugging an aggregate or table function, you can optionally call FNC_Trace_Write, which is restricted to UDFs that execute on an AMP.

  6. Use a SELECT statement to query the trace table and retrieve the trace output from the UDF.