Help Needed: Calling Stored Function from Laravel Controller #52202
Replies: 4 comments 16 replies
-
Hi there, I don't know that much but I think maybe the problem is that in the non-working example, you're not wrapping the query in DB::raw() while you're doing that in the first example? |
Beta Was this translation helpful? Give feedback.
-
The thing is that I already test it with the Oracle SQL Developer. I call the stored function with the same values from the Oracle SQL Developer Database and from the Laravel project. From the Oracle SQL Developer it returns the correct value, but from the Laravel project it doesn't. I think that it could be a way in which Laravel generates the sentence or the way that it calls the function. |
Beta Was this translation helpful? Give feedback.
-
The only format that I gave it was with Carbon: |
Beta Was this translation helpful? Give feedback.
-
If I execute the select right in Oracle SQL Developer (the local enviroment) it returns the right value, I mean with that date in d-m-y format so I think maybe the format wouldn't be the problem. What do you mean with localization? I thought that the problem maybe was related to stored funcion permissions but it isn't. Now I'm trying to do it with pure PHP Vanilla inside the Laravel project even though I know that it isn't a good practice, but just to debug the problem and check if the problem is in how Laravel manage the select. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, first of all sorry for the extension but I think that the only way you could understand is by giving you the whole picture.
I hope someone can help me with this issue I'm facing. Here's the context:
I hope my explanation is clear. Any suggestions or help would be greatly appreciated.
Here is the code for the function call that returns the correct value (and which I used as an example for the one causing the error):
`public function tieneTitulo(Request $request){
$ope = $request->operatoria;
$barrio = $request->barrio;
$adju = $request->adju;
Here is the code for the function call that always returns 0 (and which I'm trying to debug):
`public function consultarAdeuda(Request $request) {
$ope = $request->operatoria;
$barrio = $request->barrio;
$adju = $request->adju;
$fecha = Carbon::createFromFormat('d/m/y', '15/07/24')->format('d-m-y');
The code of routes:
Route::get('juridicos/juicios/consultarAdeuda', [JuiciosController::class, 'consultarAdeuda'])->name('juridicos.juicios.consultarAdeuda');
Here is the code for the Oracle database function in Oracle SQL Developer (you can use any of both links):
https://drive.google.com/uc?export=view&id=1MUQd3laGzfw1w2uW5L5X7hPDwmooO-t9
https://drive.google.com/file/d/1MUQd3laGzfw1w2uW5L5X7hPDwmooO-t9/view?usp=drive_link
Thank you very much for your help!
Beta Was this translation helpful? Give feedback.
All reactions