我有以下存储过程..
CREATE PROCEDURE USP_COM_MST_DEL(
@Code AS INT = 0,
@Name AS VARCHAR(50)= '',
@Type AS INT =0,
@Operation AS varchar(20) ='',
@Message AS VARCHAR(200) OUTPUT,
@Status AS VARCHAR(2) OUTPUT
)
AS
BEGIN
IF(@Operation = 'DISPLAY')
BEGIN
IF NOT EXISTS (SELECT * FROM COM_MST WHERE COM_CTCD = @Type)
BEGIN
SET @Status = '0'
SET @Message = 'NO RECORD FOUND'
END
ELSE
BEGIN
SET @Status = '0'
SET @Message = 'NO RECORD FOUND'
SELECT * FROM COM_MST WHERE COM_CTCD = @Type
END
END
END
但是当我尝试运行该程序时,它显示错误
USP_COM_MST_DEL @Operation = 'DISPLAY'
错误:
过程或函数'USP_COM_MST_DEL'需要参数'@Message',这是未提供的。
答案 0 :(得分:3)
您需要指定输出参数的位置。
declare
@Message VARCHAR(200),
@Status VARCHAR(2)
exec USP_COM_MST_DEL @Operation = 'DISPLAY', @message output, @status output
(这正是错误信息所说的)
答案 1 :(得分:1)
现在显示没有错误......
exec USP_COM_MST_DEL @Operation = 'DISPLAY',@type=4, @message ='', @status =''