You can use the TRACE statement with a quoted string or an expression to display values or comments in the output file. If the expression is not a literal expression, the expression is evaluated before it is written to the output file.
You can use the TRACE statement with an expression even if you used a TRACE OFF statement earlier in a routine. You must first, however, use the SET DEBUG statement to establish a trace output file.
The next example uses a TRACE statement with an expression after using a TRACE OFF statement. The example uses UNIX file naming conventions:
CREATE PROCEDURE tracing () DEFINE i INT; BEGIN ON EXCEPTION IN (1) END EXCEPTION; -- do nothing SET DEBUG FILE TO '/tmp/foo.trace'; TRACE OFF; TRACE 'Forloop starts'; FOR i IN (1 TO 1000) BEGIN TRACE 'FOREACH starts'; FOREACH SELECT...INTO a FROM t IF <some condition> THEN RAISE EXCEPTION 1 -- emergency exit END IF END FOREACH -- return some value END END FOR -- do something END; END PROCEDUREEnterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]