Hello,
I recently started using DreamFactory and want to call a stored procedure with parameters. However, I am unable to successfully call a procedure and I get the following error:
“message”: “Failed to call database stored procedure.\nCDbCommand failed to execute the SQL statement: SQLSTATE[42883]: Undefined function: 7 ERROR: function get_creches_latlng_distance(unknown, unknown, unknown) does not exist\nLINE 1: SELECT * FROM “get_creches_latlng_distance”($1,$2,$3)\n ^\nHINT: No function matches the given name and argument types. You might need to add explicit type casts.”,
“code”: 500
My stored procedure is defined as follows:
CREATE OR REPLACE FUNCTION "crechesSchema".get_creches_latlng_distance(
latitude0 double precision, longitude0 double precision, distance double precision)
RETURNS SETOF "crechesSchema"."crecheTable"
LANGUAGE SQL
AS $$
SELECT *
FROM "crechesSchema"."crecheTable"
WHERE
latitude IS NOT NULL AND
longitude IS NOT NULL AND
"crechesSchema".earth_distance(
"crechesSchema".ll_to_earth(latitude, longitude),
"crechesSchema".ll_to_earth(latitude0, longitude0)
) <= distance
$$;
I am trying to use the Live API for now. I use the callStoredFuncWithParams API for my schema with the following settings:
function_name: crechesSchema.get_creches_latlng_distance (also tried with unqualified name: get_creches_latlng_distance)
body:
{
"params": [
{
"name": "latitude0",
"value": 3.5
},
{
"name": "longitude0",
"value": 50.2
},
{
"name": "distance",
"value": 20000.0
}
]
}
What I am unable to understand is why the function is not found and why the types of the parameters are “unknown” in the error message.
Could someone provide some clues/ideas?
Best Regards,