3

I am trying to use case when statement to compare 2 columns with number and 'Null' value, the Proc SQL will return error as Numeric value 'NULL' is not recognized.

How to fix my code? Data type for Column A and B is VARCHAR(10).

Table alpha has 2 columns as 
column A include 1,2,3,Null,4
column B include 3,2,1,4,Null 
SELECT  case when  A = B
        then 'YES' 
        else 'NO' end 
FROM alpha

I tried to use coalesce(B,2) to assign a number for Null value, but returned same error

error as Numeric value 'NULL' is not recognized. 

However, I can use following code to find Null Row in Column a or b

select * from alpha 
where b = 'NULL'
Yumeng Xu
  • 179
  • 1
  • 2
  • 11

1 Answers1

0

Check the table to make sure that the 'Null' value is actually NULL. Then use the 'IS NULL' statement to check b.

select * from alpha 
where b is null
Vinnywoo
  • 94
  • 4