How to insert a zero instead of a NULL in oracle?

Solution 1:

You can use any of the option below.

Using NVL()

SELECT ID
    ,NVL(NAME, 0)
FROM TEST;

Using ANSI standard coalesce()

SELECT ID
    ,coalesce(NAME, '0')
FROM TEST;

Using CASE

SELECT ID
    ,CASE 
        WHEN NAME IS NOT NULL
            THEN NAME
        ELSE '0'
        END
FROM TEST;

DEMO