NULL in SQL operations in Netezza

The equivalent of Oracle’s Dual table in Netezza is a view named _v_dual


--select 1/null from _v_dual;
null
--select 1*null from _v_dual;
null
--select 1 + null from _v_dual;
null
--select 1 - null from _v_dual;
null
--select DECODE(0, 0, 1, 2/DECODE(0,0, null, 0)) from _v_dual;
1
--select DECODE(3, 0, 1, 2/DECODE(0,0, null, 0)) from _v_dual;
null
--select DECODE(4, 0, 1, 2/DECODE(5,0, null, 0)) from _v_dual;
Error: ERROR: Divide by 0

SQLState: HY000
ErrorCode: 1100

--select DECODE(4, 0, 1, 2/DECODE(5,0, null, 1)) from _v_dual;
2

Proudly powered by WordPress | Theme: Outfit Blog by Crimson Themes.