Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 19 Jul 2005 @ 14:58:43 GMT


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


Subj:   Re: COALESCE or CASE ?
 
From:   Anomy Anom

<-- Anonymously Posted: Tuesday, July 19, 2005 10:54 -->

The thread cited as evidence that there may be "subtle differences" between CASE and COALESCE says nothing of the sort. It merely states that "a" CASE statement didn't work while "a" COALESCE did. Note that there IS a "subtle difference" between the equivalent of COALESCE

     CASE WHEN C.COL1 IS NOT NULL THEN C.COL1 ELSE P.COL1 END

and the CASE statement suggested by the OP in this thread

     CASE WHEN C.COL1 IS NULL THEN P.COL1 ELSE C.COL1 END

Beyond the obvious (reversing the NULL test), the datatype of the CASE statement is determined by the first THEN expression, which could cause implicit CAST or TRANSLATE to be invoked in one case and not the other.



     
  <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