Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 06 Aug 2004 @ 08:56:55 GMT


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


Subj:   Re: Using a parameter in a macro
 
From:   Julie.Flanagan

  Now I've to write a generic query that will query this table and pull records based on conditions only on AGE column like '> 12' or '< 30' or '<=15' etc  


  I'm going to get this condition as parameter in macro and I need to plug it in my where clause and the correct condition should be interpreted 'AGE >12 ' or 'AGE < 30'  



To create Macro:

     Replace Databasename.MacroNew As
     (Select * from Table
      where
      Age > :MinAge and Age < :MaxAge)

To execute this, put the 2 values you wish to pass in for MinAge and MaxAge in brackets after the macro name, e.g.:

     Exec Databasename.MacroNew (12, 30)    (For between 12 and 30)

     Exec Databasename.MacroNew (0, 15)     (For <= 15), etc.


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023