Which is correct because the result is undefined. But if there is no error shown then how could I test for this condition? For example like: select case isnumber(5/0) when 0 then 'NaN' else 5/0 end; Which is not possible because there is no function like isnumber(). Are there alternatives?