Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored procedure out parameter error

Author  Topic 

madhan
Yak Posting Veteran

59 Posts

Posted - 2014-09-18 : 14:06:56
Hi - Stored procedure displays the follwing error.

Procedure or function 'getFavoriteList' expects parameter '@category_name', which was not supplied.

I have code


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[getFavoriteList]
@customer_id int,
@category_name varchar(200) OUTPUT
as
begin

SET NOCOUNT ON

select @category_name= category_name from dbo.Favorite_list
where customer_id=@customer_id

end


category_name is a coumn that is in Favorite_list table. Please help

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-18 : 14:11:48
Please post the code you are using to execute the stored procedure
Go to Top of Page

madhan
Yak Posting Veteran

59 Posts

Posted - 2014-09-18 : 14:19:12
Thanks,

execute getFavoriteList 87381

I have given value for input parameter and trying to execute
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-18 : 14:34:34
You need to specify a variable for the OUT parameter, e.g.


declare @catname int;
execute getFavoriteList 87381, @category_name = @catname OUT;
Go to Top of Page

Upendra Gupta
Starting Member

12 Posts

Posted - 2014-09-19 : 06:27:56
unspammed
Go to Top of Page

Lincolnburrows
Yak Posting Veteran

52 Posts

Posted - 2014-09-20 : 06:28:02
Please show how you are executing this procedure.
Go to Top of Page

Lincolnburrows
Yak Posting Veteran

52 Posts

Posted - 2014-09-20 : 07:08:24
quote:
Originally posted by gbritton

You need to specify a variable for the OUT parameter, e.g.


declare @catname int;
execute getFavoriteList 87381, @category_name = @catname OUT;





@category_name data type is varchar in OP question, you declare it as int
Go to Top of Page
   

- Advertisement -