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

Condition for generating NULL - response (3) by msk.khurram

$
0
0

What I think is that IS NULL is just being checked against the function output, whether it is an error code or a true value. 
If you check the same against the NOT NULL, then it gives the correct results. for example

SELECT CASE WHEN ACOS(2.3)  IS NOT NULL THEN 'T' ELSE 'F' END AS C0,

                    CASE WHEN ACOS(0.23) IS NOT NULL THEN 'T' ELSE 'F' END AS C1

 

To avoid an error value to be checked and return an error instead of blind check, you can use a derived table as below:

 

SELECT TOP 2 CASE WHEN  DRV.A  IS NULL THEN  'T' ELSE 'F' 
END AS C0
FROM 
(
SELECT ACOS(0.23)  AS A
)DRV;

 

 

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>