how to execute stored procedure from laravel

How to execute stored procedure within Laravel

Spread the love

In this tutorial I will guide you on how to execute stored procedure from Laravel. The stored procedure can be execute from Laravel by following ways:

Procedure with parameters, first approach

DB::select('exec my_procedure("parameter1", "parameter2",..)');

Procedure with parameters, second approach

DB::select('exec my_procedure(?,?,..)',array($parameter1,$parameter2));

Simply call stored procedure without parameters

DB::select('EXEC my_procedure');