Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 04 Dec 2004 @ 11:36:06 GMT


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


Subj:   Re: COALESCE() Troubles
 
From:   Dieter Noeth

Anomy Anom wrote:

  I'm getting a "3800: DataType mismatch in THEN/ELSE expression" error, on my COALESCE part of a query.  


  The problem query is similar to this:  


          SELECT
            A.PI_Column1
            ,A.PI_Column2
            ,COALESCE( MIN( B.CHAR_20_FIELD ), 'String Literal')  AS Attrib1
          FROM
            DB.Table  A
          LEFT OUTER JOIN
            DB.Table  B
          ON (A.PI_Column1 = B.PI_Column1
          AND A.PI_Column2 = B.PI_Column2)
          GROUP BY 1,2,3
          ;
  Any insights as to why COALESCE does not like my MIN()? I can't find the SQL right now, but I'm sure I've done this MIN() logic in a COALESCE before.  



Works on my system...

Is B.CHAR_20_FIELD really a Char/Varchar?

You could try to rewrite it, maybe this one is ok:

     ,MIN( COALESCE( B.CHAR_20_FIELD, 'String Literal'))  AS Attrib1

Dieter



     
  <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