Using
COALESCE
is one option and works fine as long as you choose a value that cannot exist in the original data. Otherwise you could have false results, depending on the logic.
Another option (perhaps a typical way) is to use
IS [NOT] NULL
relational operator. If you want to include
NULL
values then something like
SELECT COALESCE(PRODUCT_CODE,'UNKNOWN') AS PRODUCT_CODE,
COALESCE(PRODUCT_TYPE, 'UNKNOWN') AS PRODUCT_TYPE
FROM PRODUCTS
WHERE ( PRODUCT_CODE IN IN ('ABGC','89ABHS')
OR PRODUCT_CODE IS NULL)
AND ( PRODUCT_TYPE IN ('BEDDING','SPORTSWEAR')
OR PRODUCT_TYPE IS NULL);
Note that this also may affect the execution plan created by the optimizer.