All Forums Database
skh0514 2 posts Joined 05/07
31 May 2007
SQL: Using COALESCE in subquery

Hi all,I would like to know if COALESCE Function can be used in subquery on Teradata like other RDBMS.I've read Teradata Manuals, but I can't find any comments about it. COALESCE is more faster than NULLIF I heard, is it true on Teradata?Thanks for your help.

Luckyhansh 30 posts Joined 08/06
31 May 2007

yes, coalesce can be used in subquery but it was not suggested, Use coalesce in subqueries will not use the indexs.so you may first normalize your data before run the queries, and insert the normalized data into temporary tables, then run you query, it will help much As for nullif . i heard there are little difference. In fact , NULLIF and coalesce just like macro.so don't pay more attention to it Regards:-)

skh0514 2 posts Joined 05/07
31 May 2007

Thank you for your response!I and my colleague start to use it instead of CASE function. It is useful but there is not so much information about it.To use COALESCE in subquery doesn't use indexes helps us very much.Thanks again!skh

Luckyhansh 30 posts Joined 08/06
31 May 2007

btw:COALESECE and CASE is for different use,coalesce can only deal with null values, while case have more

You must sign in to leave a comment.