Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Wed, 13 Feb 2013 @ 19:50:13 GMT


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


Subj:   Re: Need to filter Numeric value from Alphanumeric string
 
From:   Usenko, Yuriy

Hi.

Long time ago in my TD Professional Support life we use something like this procedure. I hope this help.

You can try to update this code to recursion query.

Sorry, recursion example I can't find in my archive.

     CREATE PROCEDURE string_remover
     (
        INOUT str_1 char(2550)
     )

     BEGIN

        DECLARE  i INT;
        DECLARE str_2 CHAR(2550);
        SET str_2= '';
        SET i = CAST( CHAR(TRIM (str_1)) AS INT ) ;

             WHILE ( i > 0)
             DO
                IF ( SUBSTR ( str_1, CAST  (i AS  INT )  ,  1)
                        IN  ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') ) THEN
                   SET str_2=  SUBSTR (str_1, CAST (  i AS INT )  ,  1) ||  str_2 ;
                END IF;
             SET i = i - 1;
             END WHILE;
        SET str_1 =TRIM (  str_2 ) ;

     END;

Yuriy Usenko
Teradata Global Techical Support.



     
  <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: 24 Jul 2020