如何从Laravel执行存储过程 [英] How to execute Stored Procedure from Laravel
本文介绍了如何从Laravel执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表单提交数据后,我需要执行一个存储过程.我的存储过程可以按我的意愿运行,并且我的表单可以正常运行.我只是不知道从laravel 5执行sp的语句.
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 the statement to execute the sp from laravel 5.
应该是这样的:执行my_stored_procedure.但我似乎无法在网上找到类似的东西.
it should be something like this: execute my_stored_procedure. but I can not seem to find anything like that online.
推荐答案
尝试类似的方法
DB::select('exec my_stored_procedure("Param1", "param2",..)');
或
DB::select('exec my_stored_procedure(?,?,..)',array($Param1,$param2));
尝试使用不带参数的
DB::select('EXEC my_stored_procedure')
这篇关于如何从Laravel执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文