Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 05 Jul 2011 @ 13:21:36 GMT


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


Subj:   Re: Loopin through a string of Text
 
From:   David Clough

D.I. Christian Schiefer said

  a recursive SQL can solve this problem.  


I suspect he actually meant "a recursive Procedure can solve this problem" .... and that's exactly what I've just written.

     CALL DEVDBA_X.COLS_FROM_STRING_P ('COLA,COLB,COLC', '', 0, ResultCode, ResultMsg);

     SEL * FROM DEVGTT_T.DERIVED_COLUMN_GTT ORDER BY COL_POSN_NR;

     2011-07-05 11:54:59.450000        0        COLA,COLB,COLC
     2011-07-05 11:54:59.480000        1        COLA
     2011-07-05 11:54:59.510000        2        COLB
     2011-07-05 11:54:59.540000        3        COLC

Cool, if I say it myself !

It would be even better if I could do the Oracle approach of something like this :

     SEL * TABLE(DEVDBA_X.COLS_FROM_STRING_P ('COLA,COLB,COLC', '', 0, ResultCode, ResultMsg));

I just think it's ever so slightly messy having to then read a (Global Tempoary) Table - oh well, never mind. It's good enough.


Regards

David Clough
Senior Database Designer



     
  <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