I have this query that comes out with null values and numbers in the Vet_Ben_Code column. I want all the NULL to Read as 0 and all the other numbers to stay the same how do I do This. Here is the query:
SELECT STU.Term_Code,
STU.PIDM,
STU.Vet,
RXR.Vet_Ben_Code
FROM
(SELECT CST.Term_Code,
CST.PIDM,
SPB.Vet
FROM
(SELECT Term_Code,
PIDM
FROM CHELINK.Combined_Student_Table
WHERE Term_Code BETWEEN '201170' AND '201670'
)CST
INNER JOIN
(SELECT SPBPERS_PIDM,
SPBPERS_VETC_FILE_NUMBER Vet
FROM SATURN.SPBPERS
WHERE SPBPERS_VETC_FILE_NUMBER LIKE 'Y%'
OR SPBPERS_VETC_FILE_NUMBER LIKE 'y%'
)SPB
ON CST.PIDM = SPB.SPBPERS_PIDM
)STU
LEFT JOIN
(SELECT RXRVETN_Term_Code_VA AS Term_Code,
RXRVETN_PIDM AS PIDM,
RXRVETN_Vetc_Code AS Vet_Ben_Code
FROM FAISMGR.RXRVETN
WHERE RXRVETN_Term_Code_VA BETWEEN '201170' AND '201670'
)RXR
ON STU.Term_Code = RXR.Term_Code
AND STU. PIDM = RXR.PIDM
You can use NVL
:
NVL(col, 0)
or COALESCE
:
COALESCE(col, 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With