Like global temporary tables, global temporary trace tables have a persistent definition, but do not retain rows across sessions.
Global temporary trace tables are not hashed. Instead, each table row is assigned a sequential hash sequence. You can perform an INSERT … SELECT operation on the table to copy its rows into a normal hashed table with a primary key, indexes, or additional attributes common to other base table types if you need to do so.
Define the information you want to trace as the input to the UDF. The UDF can then call the FNC_Trace_Write_DL function that places the information in a global temporary trace table. If the trace is not turned on, the system does no function traceback, though there is still some overhead because the system still calls the UDF. SeeTeradata Vantage™ - SQL External Routine Programming, B035-1147 and SET SESSION FUNCTION TRACE.
Run the trace UDF in non-protected mode once it has been debugged to ensure that it executes in-line with the procedure. A premature end of the procedure or a rollback of the transaction has no impact on the global temporary trace table, and its contents are not deleted until the session logs off. Enabling function traceback makes your procedure run more slowly because each trace call forces the data to be written into the trace table. Nothing is buffered to ensure that nothing is lost while you are testing a function.