以下のコードを使用して関数を作成しますが、実行したいときにエラーが発生します
CREATE FUNCTION getFactorPriceFunction
(
@factorCode BIGINT
)
RETURNS bigint
AS BEGIN
RETURN
(
select SUM(price*coun) as total from CustomerFactor inner join CustomerFactorDetails
on CustomerFactor.code=CustomerFactorDetails.factorCode inner join ProductDetails on
ProductDetails.code=CustomerFactorDetails.productDetailsCode
where factorCode=@factorCode AND final=1
)
END
実行する:
select total from getFactorPriceFunction(100)
エラー:
無効なオブジェクト名「getFactorPriceFunction」