我有這個查詢出來與Vet_Ben_Code列中的空值和數字。 我希望所有的NULL讀取爲0和所有其他數字保持不變,我該怎麼做。下面是該查詢:如果NULL然後0否則其他值
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
NVL(RXR.Vet_Ben_Code,0) – OldProgrammer