Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 15 Oct 2009 @ 14:32:11 GMT


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


Subj:   Recursive procedure error
 
From:   Padarthi, Hanumath

Hi,

I have little variety of requirement

I am receiving a coma (,) delimited string from a procedure Parameter and need to split it and store this information in a Temporary table. I am trying to use recursive call inside the procedure instead of calling the procedure recursively but when Inserting the values in temp table system is throwing error.

     WITH recursive RECT(sno,resttext,no_of_element) as
           (select ROOT.SNO, root.text, 1
            from MYDATABASE.MYSAMPLEDATA ROOT
            UNION ALL
            select
             PARENT.SNO,
             substr(PARENT.resttext,
                    position(',' in PARENT.resttext)+1,
                    characters(trim(PARENT.resttext))
                    ) as resttext
             ,no_of_element+1
            from
              RECT PARENT
            where position(',' in PARENT.resttext)<>0
          )
          INSERT INTO MYDATABASE.MYTEMPTABLE(
          select  case when position(',' in resttext)<>0
                then substr(resttext,
                   1,
                   position(',' in resttext)-1
                   )
                else
                   resttext
                end as parttext
          from RECT)     ;

     3707: Syntax error, expected something like 'SELECT' Keyword or '('
     between ')' and the Insert Key word.

If this will not work, please give me some working example to accomplish my requirement.


Regards,

Kumar



     
  <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