Changing a SUM returned NULL to zero

前端 未结 6 1736
旧巷少年郎
旧巷少年郎 2021-02-05 01:54

I have a stored procedure as follows:

CREATE PROC [dbo].[Incidents]
(@SiteName varchar(200))
AS
SELECT
(  
    SELECT SUM(i.Logged)  
    FROM tbl_Sites s  
             


        
6条回答
  •  无人及你
    2021-02-05 02:41

    I encountered this problem in Oracle. Oracle does not have an ISNULL() function. However, we can use the NVL() function to achieve the same result:

    NVL(SUM(c.Logged), 0)
    

提交回复
热议问题