pc_oc
pc_oc

Reputation: 545

SQLSTATE[HY000]: General error: 2053 when call SP

I am using Laravel 4.2 and am calling a Stored procedure from a database on the server. Locally it works fine, but on the server, using the same DB, it gives error. The call is as follows (I just want to make select):

$result = DB::select('CALL sp_special_prices("'.$codClient.'", "'.$codProduct.'", "'.$quantity.'", "'.$grup.'", "'.$FirmCode.'")');

When running a product listing on the server, it works except for two articles, giving the following error:

Caught exception: SQLSTATE[HY000]: General error: 2053 (SQL: CALL sp_special_prices("C000000", "445706049", "1", "146", "75");) 

I already checked the php versions, and am using 5.6 on both sites. Could it be some special configuration? Is that the DB is the same, the place to call the SP, is that it is different.

Upvotes: 1

Views: 1777

Answers (1)

Paras
Paras

Reputation: 9465

If the procedure doesn't return anything, you need to use DB::statement instead of DB::select. If it does return something, you need to use DB::select

If the procedure has variable behaviour (may or may not return data depending on input), I suggest you change the procedure to return some data for all input combinations

Upvotes: 5

Related Questions