Reputation: 1
when I try to run the command:
$pdo = DB::connection($group)->select("exec prc_recebcobdsg('0', 'null','01-01-2021', '27-01-2021', 'null')");
My Laravel page returns: Error Code : 900 Error Message : ORA-00900: invalid SQL statement Position : 0 Statement : exec prc_recebcobdsg('0', 'null','01-01-2021', '27-01-2021', 'null') Bindings : [] (SQL: exec prc_recebcobdsg('0', 'null','01-01-2021', '27-01-2021', 'null'))
Where am I wrong?
Upvotes: 0
Views: 794
Reputation: 61
I don't really know Laravel but I believe there are two issues.
Firstly exec
is not actually an Oracle statement it is just a shorthand available in sqlplus and sqldeveloper and other clients. Usually you need to enclose the procedure call in a begin / end block.
The second issue is that execution of a stored procedure is not really a select so you can not use the select
method of connection. I believe you can use exec
method.
Something like this should work:
DB::connection($group)->getPdo()->exec("begin prc_recebcobdsg('0', 'null','01-01-2021', '27-01-2021', 'null'); end;");
Upvotes: 1