-- Replace 0 values by a default value SELECT nvl(NullIf(COL, 0), 99) FROM (SELECT 0 AS COL FROM DUAL); -- 99 SELECT nvl(NullIf(COL, 0), 0) FROM (SELECT 500 AS COL FROM DUAL); -- 500