Archives of the TeradataForum
Message Posted: Sat, 06 Oct 2001 @ 01:33:14 GMT
I am not sure what example you have seen, but I will take a shot at answering my understanding of your question regarding the USING and EXPLAIN.
The following macro uses 2 parameters as input.
REPLACE MACRO My_macro (in_1 integer, in_2 char(3)) AS (UPDATE mytable SET column1 = column1 + 10 WHERE column2 = :in_1 AND column4 = :in_2 ; SELECT column1, column2, column3, column4 FROM mytable AS MT RIGHT OUTER JOIN table2 ON MT.column4 = table2.column6 WHERE MT.column2 = :in_1 AND ( table2.column4 = :in_2 OR MT.column4 IS NULL ) ; ) ;
If you do the following: EXPLAIN EXEC Mybetter_macro (10, 'XYZ');
The optimizer has already optimized the macro with the values of 10 and XYZ. Therefore, the time estimation is less accurate.
Therefore, by incorporating the USING as seen here:
USING A INT, B CHAR(3) EXPLAIN EXEC Mybetter_macro (:A, :B);
The EXPLAIN gives a better estimate of the processing required at runtime.
I hope this helps you understand the difference.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|