Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 21 Dec 2005 @ 14:01:33 GMT


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


Subj:   Re: Passing the value for an IN clause to a stored
 
From:   cbarrineau

In this case, I think you'll need to make the stored procedure a little more robuts. The problem is, the RDBMS sees your input parameter as a single value, not a string of values.

You will need to loop through your 'Varlist' parameter and insert its parsed up values as seperate rows into a table (probably you'd prefer a global temp table and potentially you will not want to preserve rows, in which case you will want to use BT/ET in your SPL.)

Once the parsed values are in a table, you should be able to join to this table and run the SQL you have below:

     SPLabel:

     BT;

     Parse_Loop:

     Loop

     If (done parsing yet) then Leave Parse_Loop;
     End If;

     Parsing Logic...
     Insert into GT_Table Values (StateValue)...

     End Loop Parse_Loop

     select count(branch_id)
     into :valout
     from branch
     ,     GT_Tablename
     where branch.mail_state = GT_Tablename.Mail_State;

     Et;

     End;

Typically, for this kind of SPL, we pass the state values in the following format 'GA|FL|AL|MI.'


Hope this helps,

Clay



     
  <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