You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
just wanted to report this. Environment:
MariaDB 10.11.6
db2rest docker
|:: db2rest version :: v1.4.2 |
|:: Spring-Boot version :: v3.3.5 |
I have created an SQL function,
when I call this function using SQL
SELECT search_series_group('Absolute') AS search_result;
it works
but when I try using db2rest to call it, I get this output every time.
{
"type": "https://db2rest.com/error/generic-error",
"title": "Generic Data Access Error",
"status": 400,
"detail": "Database ID not found.",
"instance": "/error",
"errorCategory": "Data-access-error",
"timestamp": "2025-01-17T22:20:30.894810660Z"
}
I tried creating the same function as procedure and tried calling it again with db2rest and it worked. So, for some reason function calls do not work while procedure calls work. Does not work
-- Create the search_series_group functionCREATE OR REPLACEFUNCTIONsearch_series_group_function(series_name VARCHAR(255)) RETURNS JSON
DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE result JSON;
-- Select matching series group from series_groups or via alternative namesSELECT JSON_OBJECT(
'series_group_id', sg.series_group_id,
'series_group_name', sg.series_group_name,
'shorthand_series_group_name', sg.shorthand_series_group_name
)
INTO result
FROM series_groups sg
LEFT JOIN series_group_alternative_names sgan ONsg.series_group_id=sgan.series_group_idWHEREsg.series_group_name= input_term
ORsgan.alternative_series_group_name= input_term
LIMIT1;
-- Return the JSON object or NULL if no matches
RETURN IFNULL(result, NULL);
END;
CREATE OR REPLACE PROCEDURE search_series_group_procedure(IN series_name VARCHAR(255)) DETERMINISTIC READS SQL DATA BEGIN
DECLARE result JSON;
-- Select matching series group from series_groups or via alternative namesSELECT JSON_OBJECT(
'series_group_id',
sg.series_group_id,
'series_group_name',
sg.series_group_name,
'shorthand_series_group_name',
sg.shorthand_series_group_name
) INTO result
FROM series_groups sg
LEFT JOIN series_group_alternative_names sgan ONsg.series_group_id=sgan.series_group_idWHEREsg.series_group_name= series_name
ORsgan.alternative_series_group_name= series_name
LIMIT1;
-- Return the JSON object or NULL if no matchesSELECT IFNULL(result, NULL) AS search_result;
END;
The text was updated successfully, but these errors were encountered:
@Salvora I noticed a possible error in your function v/s procedure in function you are not using the input series_name. That may cause the function to be not compiled correctly. Offcourse the error message from DB2Rest is not helpful either. I have created another issue to fix these error reporting. Please do take a look and let us know.
Hey,
just wanted to report this.
Environment:
MariaDB 10.11.6
db2rest docker
|:: db2rest version :: v1.4.2 |
|:: Spring-Boot version :: v3.3.5 |
I have created an SQL function,
when I call this function using SQL
SELECT search_series_group('Absolute') AS search_result;
it works
but when I try using db2rest to call it, I get this output every time.
I tried creating the same function as procedure and tried calling it again with db2rest and it worked. So, for some reason function calls do not work while procedure calls work.
Does not work
works
The text was updated successfully, but these errors were encountered: