Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 22 Dec 2008 @ 15:55:32 GMT


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


Subj:   Re: How to Get Count(*) in UNIX Variable
 
From:   Leslie, Quincy

It would depend on the source of the value of the "count", be it row count, byte count, etc. If you are obtaining the count within the Unix script via some type of expression, then the count could be obtained and captured in a pair of variables, via:

Generally CT1=table one count= count_value

CT1='expression_to_get_table'_count'; use back tics to surround the count values

CT2='expression_to_get_table2_count'

To compare the values then use the shell script comparison techniques, which which will be slightly different depending on whether you are using Korn Shell, Bourne Shell, or C Shell. A variation on Bourne & Korn C

     IF [ $CT1 > $CT2 ]     if [ $CT1 > $CT2 ]    if [ $CT1 > $CT2 ] then
         THEN                        then                         do_action
             Shell_action            do_action          endif
        FI                                   fi

If you are allowed to run Unix scripts in the Unix node, then you can jump in and out of BTEQ to extract values.

Please remember that the characters to remark out expressions is different for the Unix script "#", vs. any SQL you are running "--" or "/*...*/" or the two can collide when mixing SQL within Unix scripts.


Hope this is a start.

Quincy Leslie



     
  <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