Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Condition for generating NULL - response (2) by eliot

$
0
0

Hi Khurram,
Thanks for the help! I'm able to observe NULL value with the query you give. However another question is how can I come up with a query that check for NULL values from output of an expression? In other words, how to re-write the first query that judge whether an expression will generate NULL value and based on that, build a flag to indicate whether NULL value is found or not?
Following your idea, I wrote this query, which seems to be working:
        SELECT CASE WHEN (CASE WHEN (ACOS(2.3) IS NULL) THEN 'T' END) IS NULL THEN 'T' ELSE 'F' END AS C0
However this query will always return 'T', even when the expression is valid. For example, the query below will return two 'T' upon execution, however 'C1' should actually be 'F' in this case.
        SELECT CASE WHEN (CASE WHEN (ACOS(2.3) IS NULL) THEN 'T' END) IS NULL THEN 'T' ELSE 'F' END AS C0,
                    CASE WHEN (CASE WHEN (ACOS(0.23) IS NULL) THEN
'T' END) IS NULL THEN 'T' ELSE 'F' END AS C1
 
Best Regards,
Eliot


Viewing all articles
Browse latest Browse all 14773

Trending Articles