Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 18 Oct 2001 @ 10:39:58 GMT


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


Subj:   Case statements
 
From:   Anomy Anom

<-- Anonymously Posted: Thursday, October 18, 2001 05:33 -->

Hi

We regularly use CASE statements in our code as they are excellent in that only one pass of a table is required to satisfy a query.

However, has anyone any views on how these case statements should be constructed? For example:

CASE    WHEN COL1 = 'A' THEN 'ANSWER A'
        WHEN COL1 = 'B' THEN 'ANSWER B'
        WHEN COL1 = 'C' THEN 'ANSWER C'
        WHEN COL1 = 'D' THEN 'ANSWER D'
ELSE    'OTHER'
END

Are there likely to be performance differences when most of the values in COL1 are 'A' versus when most of the values in COL1 are 'D'?

Your comments would be appreciated.



     
  <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