php 如何在 Laravel 上调用存储过程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30498227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to call stored procedure on Laravel?
提问by Software Engineer
Error comes when i run update stored procedure in laravel5 like this..
当我像这样在 laravel5 中运行更新存储过程时出现错误..
QueryException in
Connection.php line 620: SQLSTATE[42000]:
Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near'Sandeep,09999999999,,,[email protected],,,,,,,)'
at line 1(SQL: call sp_clientupdate(108, Sandeep,09999999999,,,[email protected],,,,,,,))
Connection.php line 620: SQLSTATE[42000]:
语法错误或访问冲突中的QueryException :1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取'Sandeep,09999999999,,,[email protected],,,,,,,)'
在第 1 行附近使用的正确语法(SQL: call sp_clientupdate(108, Sandeep,09999999999,,,[email protected],,,,,,,))
my code is....
我的代码是....
return DB::select('call sp_clientupdate(108, Sandeep,0999999999,,,[email protected],,,,,,,)');
Pls anyone give me solution.....
请任何人给我解决方案.....
采纳答案by Prashant Patel
You change.
你改变。
return DB::select('call sp_clientupdate("108", "Sandeep","0999999999","","","[email protected]","","","","","","",)');
Try it's working perfectly....
尝试它完美地工作......
回答by Tonmoy Nandy
Try this one,
试试这个,
DB::statement('call sp_clientupdate("108", "Sandeep","0999999999","","","[email protected]","","","","","","",)');
It works perfectly.
它完美地工作。