Home Page for the TeradataForum
 
 

 

Archives of the TeradataForum





Message Posted: Fri, 06 Aug 2004 @ 13:31:18 GMT





     
  <Prev Next>   <<First <Prev Next> Last>>  




Subj:   Re: Using a parameter in a macro
 
From:   Michael Larkins



I think the best way to handle this with flexibility is to use something like this:

     replace macro sql01.Comparer (oper char(2), firstval int, secondval int) AS
      (sel *
      from student_table
     where :oper = 'EQ' and grade_pt = :firstval
        or :oper = 'GT' and grade_pt > :firstval
        or :oper = 'LT' and grade_pt < :firstval
       or :oper = 'RG' and grade_pt between :firstval and :secondval
     ;);

To run:

     exec sql01.Comparer ('EQ',2,);
     exec sql01.Comparer ('LT',2,);
     exec sql01.Comparer ('RG',2,3);

Of course, this can be expanded to allow for any comparison that you need.


Hope this helps,

Michael Larkins
Terateach Consulting and Coffing Data Warehousing
Certified Teradata Master
Certified Teradata SQL Instructor





     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
 
  Top Home Join Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky 
Last Modified: 30 Jun 2008