SQL中存储过程调用存储过程,怎么取返回值
1个回答
展开全部
存储过程中的第一个参数 @title 将接收由调用程序指定的输入值,而第二个参数 @ytd_sales 将向调用程序返回该值。SELECT 语句使用 @title 参数以获得正确的 ytd_sales 值,并将该值赋予 @ytd_sales 输出参数。
CREATE PROCEDURE get_sales_for_title
@title varchar(80), -- This is the input parameter.
@ytd_sales int OUTPUT -- This is the output parameter.
AS
-- Get the sales for the specified title and
-- assign it to the output parameter.
SELECT @ytd_sales = ytd_sales
FROM titles
WHERE title = @title
RETURN
GO
CREATE PROCEDURE get_sales_for_title
@title varchar(80), -- This is the input parameter.
@ytd_sales int OUTPUT -- This is the output parameter.
AS
-- Get the sales for the specified title and
-- assign it to the output parameter.
SELECT @ytd_sales = ytd_sales
FROM titles
WHERE title = @title
RETURN
GO
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询