19 May 18 ·  nVector in teradata ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

Teradata: How to compare potentially null fields without using coalesce?


When we are comparing two null fields, the result is always a fail. Lets see how to handle such scenarios.

  • Null <> Null (Null is never equal to Null)
  • Null <> ''
  • Null <> 0


We are using a query that uses coalesce to compare potentially null values. it does make queries more difficult to maintain, it's flat out ugly. but cant help it:

where coalesce(tbl1.field,'~') <> Coalesce(tbl2.field,'~')


posted on 19 May 18

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds