Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 09 Apr 2014 @ 20:42:04 GMT


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


Subj:   ARRAY reference in a Stored Procedure
 
From:   David Clough

What I'd like to do is something like this :

     SET ExtEmailAddressArray = NEW EMAIL_ADDRESS_A01; --{20 element 1-D Array}

     SET nL_ArrayCt = CARDINALITY(ExtEmailAddressArray);
            --
        REPEAT
           -- this next line is the one to consider .....
            IF ExtEmailAddressArray[nL_ArrayCt] = someInvalidValue THEN
                do something ;
            END IF;
            --
           SET nL_LoopCt = nL_LoopCt + 1;
           UNTIL nL_LoopCt > nL_ArrayCt
        END REPEAT;

... but it complains about the reference to ExtEmailAddressArray[nL_ArrayCt]

If I do

      " IF ExtEmailAddressArray[1] = someinvalidvalue THEN "

.... It's fine (i.e. if I give it a fixed number).

but .... surely .... Teradata have not made the reference to an Array Element within a Stored Procedure specific to a number .... have they?

OK, I can repeat the code for each element in the array - up to 20 times - but that's a little bit crap.

I've tried prefixing the Variable with a Colon, but no good :

E(3707):Syntax error, expected something like an integer or a decimal number or a floating point number or '+' or '-' between '[' and ':'.'.

Does anyone know of a SMART way of doing this ?


Regards

David Clough
Senior BI Database Designer
BI Competency Centre



     
  <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