Reputation: 85
Where do we need to use output parameter in a stored procedure?
Does anyone have any real time experience to share?
I searched a lot but not able to understand proper use of output parameter.
Upvotes: 2
Views: 1401
Reputation: 82474
There are many occasions where you want to get some data back from a stored procedure in the form of an output parameter:
There are probably more situations where an output is useful, but I think that should answer your question.
Upvotes: 2
Reputation: 57774
There are several good answers already, but one not mentioned is when you need the procedure to return more than one variable.
Example: Searching for the highest salary a procedure might also return the I.D. of the person and whether they are still employed.
Upvotes: 1
Reputation: 9456
It is to pass a value out of the stored procedure. Either a rowset reference, or a scalar value. Think of it as turning stored procedures into function calls.
Upvotes: 0