I have a stored procedure to be called from Laravel. It takes 4 inputs and returns a string data. My code:
$getStatus = DB::select(
"EXEC rsp_GetStatus '" .
$flag .
"', $id, $this->userId,
'" . $country . "',
'' "
);
But I'm getting the error:
"The active result for the query contains no fields".
Tried using:SET NOCOUNT ON
$status = DB::select("SET NOCOUNT ON; EXEC rsp_GetStatus ?, ?, ?, ?, ?",
[
$flag,
$id,
$this->userId,
$country,
'']);
Still the error . This store procedure checks the id and returns a string value:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[rsp_GetStatus ]
@param_flag varchar(25),
@param_id bigint,
@param_userid int,
@param_countryoforigin varchar(25),
@param_suggestedFlag varchar(25) output
As
Begin
Select @param_suggestedFlag = (select ...)
End
Any help would be much appreciated.
1条答案
按热度按时间kq0g1dla1#
As suggested by @AlwaysLearning and @Zhorov declaring the Output variable and fetching it worked. Here is the solution: