Reputation:
I have the following stored procedure..
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
But when I try to run the procedure.. it shows an error
USP_COM_MST_DEL @Operation = 'DISPLAY'
Error:
Procedure or function 'USP_COM_MST_DEL' expects parameter '@Message', which was not supplied.
Upvotes: 0
Views: 937
Reputation:
This is now displaying with no error...
exec USP_COM_MST_DEL @Operation = 'DISPLAY',@type=4, @message ='', @status =''
Upvotes: 1
Reputation: 51494
You need to specify where the output parameters should go to.
declare
@Message VARCHAR(200),
@Status VARCHAR(2)
exec USP_COM_MST_DEL @Operation = 'DISPLAY', @message output, @status output
(which is exactly what the error message is saying)
Upvotes: 3