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:
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;
$query = "SELECT usua400.fun_tiene_titulo(:ope, :barrio, :adju, 'T') as respuesta from dual";
$resultados = DB::select(DB::raw($query), ['ope' => $ope, 'barrio' => $barrio, 'adju' => $adju]);
//dd($resultados);
if (empty($resultados)) {
return response()->json(['message' => 'Sin datos.']);
} else {
return response()->json($resultados[0]);
}
}`
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');
try {
$result = DB::select('SELECT iprodha.fun_adeuda_mont(:ope, :barrio, :adju, :fecha) as respuesta from dual', [
'ope' => $ope,
'barrio' => $barrio,
'adju' => $adju,
'fecha' => $fecha,
]);
if ($result === null){
return response()->json(['respuesta' => 'Sin datos.']);
} else {
return response()->json(['respuesta' => $result[0]->respuesta]);
}
} catch (\Exception $e) {
return response()->json(['message' => 'Ocurrió un error al ejecutar la consulta: .'], $e->getMessage());
}
}`
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!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community