How to execute Stored Procedure from Laravel

前端 未结 11 1584
无人及你
无人及你 2020-12-01 00:28

I need to execute a stored procedure after my form submits data. I have the stored procedure working like I want it, and I have my form working properly. I just do not know

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 00:58

    If your stored procedure always returns something then you can go with

    DB::select("exec StoredProcedure '1','A','PARAM');
    

    Otherwise (if there is no response from the SP) it will throw an exception. In that case I recommend using

    DB::statetment("exec StoredProcedure '1','A','PARAM'");
    

提交回复
热议问题