- Limit checks on input values
- Limit checks on return values
- Proper handling of NULLs
- Division by zero
- All memory acquired by malloc is freed
- All open operating system handles are released and closed
The Teradata C/C++ UDF Debugger allows user-defined methods to be debugged within the database on a development or test system. For more information on the Teradata C/C++ UDF Debugger, see C/C++ Command-line Debugging for UDFs.
Forcing an SQL Warning Condition
You can force an SQL warning condition at the point in the code where the method appears to have problems. To force the warning, set the sqlstate return argument to '01H xx', where you choose the numeric value of xx.
If you use parameter style SQL, you can also set the error_message return argument to return up to 256 SQL_TEXT characters.
The warning is issued as a return state of the UDM. The warning does not terminate the transaction; therefore, you must set return arguments to valid values that the transaction can use.
Only one warning can be returned per invocation.
You force an SQL warning condition in a UDM in the same manner you force an SQL warning condition in a UDF. For an example of how to set the SQLSTATE result code and error message return argument in a UDF, see Forcing an SQL Warning Condition.
Using Trace Tables
If debugging outside the database is not sufficient, you can use trace tables to get trace diagnostic output.
UDMs use trace tables in the same manner as UDFs use trace tables. For a description of how to debug UDFs using trace tables, see Debugging Using Trace Tables.