Error comes when i run update stored procedure in laravel5 like this..
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],,,,,,,))
my code is....
return DB::select('call sp_clientupdate(108, Sandeep,0999999999,,,[email protected],,,,,,,)');
Pls anyone give me solution.....
You can call an SQL stored procedure with the execute, open, or get statement; in each case, you use the #sql directive. A stored procedure is a set of instructions for a database, like a function in EGL.
To call a stored procedure from a PHP application, you prepare and execute an SQL CALL statement. The procedure that you call can include input parameters (IN), output parameters (OUT), and input and output parameters (INOUT).
Stored procedures are handy for encapsulating database intensive operations. Consider Stored Procedures as an API for your database. Laravel models are often one-to-one representations of a database table. So, they don't support stored procedures out of the box.
Try this one,
DB::statement('call sp_clientupdate("108", "Sandeep","0999999999","","","[email protected]","","","","","","",)');
It works perfectly.
You change.
return DB::select('call sp_clientupdate("108", "Sandeep","0999999999","","","[email protected]","","","","","","",)');
Try it's working perfectly....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With