SQL: Using COALESCE in subquery

Database

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.

3 REPLIES
Enthusiast

Re: SQL: Using COALESCE in subquery

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:-)

Re: SQL: Using COALESCE in subquery

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

Enthusiast

Re: SQL: Using COALESCE in subquery

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