Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 04 Apr 2007 @ 09:44:19 GMT


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


Subj:   Re: String reversal function
 
From:   Stegelmann, Rolf

How about the following if the string is not too long:

     BTEQ -- Enter your DBC/SQL request or BTEQ command:
     show table ts2;

      *** Text of DDL statement returned.
      *** Total elapsed time was 1 second.

     ----------------------------------------------------------------
     CREATE SET TABLE RGS.ts2 ,NO FALLBACK ,
          NO BEFORE JOURNAL,
          NO AFTER JOURNAL,
          CHECKSUM = DEFAULT
          (
           a INTEGER,
           b VARCHAR(5) CHARACTER SET LATIN NOT CASESPECIFIC)
     PRIMARY INDEX ( a );


      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     select * from ts2;

     *** Query completed. 3 rows found. 2 columns returned.
      *** Total elapsed time was 1 second.

               a  b
     -----------  -----
               3  abcde
               1  ab
               2  abc

      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     update ts2 set b =

       substring(b from 5 for 1) ||
       substring(b from 4 for 1) ||
       substring(b from 3 for 1) ||
       substring(b from 2 for 1) ||
       substring(b from 1 for 1);

      *** Update completed. 3 rows changed.
      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     select * from ts2;

     select * from ts2;

      *** Query completed. 3 rows found. 2 columns returned.
      *** Total elapsed time was 1 second.

               a  b
     -----------  -----
               3  edcba
               1  ba
               2  cba


     
  <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