如何使用 when 子句或 where 子句从存储过程中过滤数据?

How to filter data from a stored procedure using when clause or where clause?

下面是我的代码,我想使用 where 子句从存储过程中获取数据并过滤数据,但是 where 或 when 不适用于 select 子句;

DB::select('exec my_stored_procedure(?,?)', [$a, $b])
-> where(// condition);   //this is not working

对于 laravel 存储过程中的 Where 条件,首先您必须在过程中定义结果集,对于您在过程结果中定义的那些变量或列名称,用于结果集中的条件。

程序使用:Result(Column_name)

Laravel 使用:DB::select('exec my_stored_procedure(?,?) where Column_name = ?', [$a, $b,$c])