sql sever存储过程为什么调用时都提示返回值为null
我的存储过程如下:setANSI_NULLSONsetQUOTED_IDENTIFIERONgoALTERPROC[dbo].[DRIVE](@STARTCHAR,@DE...
我的存储过程如下:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROC [dbo].[DRIVE](@START CHAR,@DESTINATION CHAR,@MODEL CHAR) AS
DECLARE @OIL FLOAT
DECLARE @DISTANCE INT
DECLARE @HFEE MONEY
DECLARE @FEE MONEY
SELECT @OIL=(SELECT OIL FROM CTYPE WHERE MODEL#=@MODEL)
SELECT @DISTANCE=(SELECT DISTANCE FROM ROAD WHERE START=@START AND DISTINATION=@DESTINATION)
SELECT @HFEE=(SELECT FEE FROM HIGHWAY WHERE ENTERANCE=@START AND [EXIT]=@DESTINATION)
SELECT @FEE=@HFEE+@OIL*@DISTANCE
return @fee
当我调用该存储过程是,总是提示:
DRIVE过程试图返回状态 NULL,这是不允许的。将返回状态 0。
0.00。
这是为什么,怎么解决这个问题 展开
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROC [dbo].[DRIVE](@START CHAR,@DESTINATION CHAR,@MODEL CHAR) AS
DECLARE @OIL FLOAT
DECLARE @DISTANCE INT
DECLARE @HFEE MONEY
DECLARE @FEE MONEY
SELECT @OIL=(SELECT OIL FROM CTYPE WHERE MODEL#=@MODEL)
SELECT @DISTANCE=(SELECT DISTANCE FROM ROAD WHERE START=@START AND DISTINATION=@DESTINATION)
SELECT @HFEE=(SELECT FEE FROM HIGHWAY WHERE ENTERANCE=@START AND [EXIT]=@DESTINATION)
SELECT @FEE=@HFEE+@OIL*@DISTANCE
return @fee
当我调用该存储过程是,总是提示:
DRIVE过程试图返回状态 NULL,这是不允许的。将返回状态 0。
0.00。
这是为什么,怎么解决这个问题 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询