Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 19 Aug 2004 @ 23:22:44 GMT


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


Subj:   Re: Arrays in macros
 
From:   Michael Larkins

Hello Mohammad:

I think I have a little bit better idea of your need. Although you cannot dynamically pass a different number of parameters, you can pass a single parameter of a varying length. Try something like this:

     cm passer (parm varchar(200)) AS
     (sel * from mytable_name
     where position (column_name in :parm) > 0;)

Note: if column_name is a char or varchar column this works fine. However, if it is a different datatype, you will need to convert it to character: position(cast(column_name AS char(<length_goes_here>)) in :parm) > 0

The trick here is to submit all your values in a single string with a delimiter between them. For instance:

     EXEC passer ('123 546 677');

This execution would find rows with these three different values.

     EXEC passer ('12 5460 6717 7908 110234');

This execution would find rows with these five different values.


Hope this helps,

Michael Larkins
Certified Teradata Master



     
  <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