Hello I need help about a Switch case better solution on oracle . So I have a function
FUNCTION GETSTAT(i_json_stats clob)
RETURN CRESPONSE AS
BEGIN
IF JSON_GET_STAT IS NOT NULL THEN
FOR i IN 1..JSON_GET_STAT.count LOOP
V_FUNCTION := json_ext.get_string(json(JSON_GET_STAT.get(i)), 'CLE');
O_RETURN_RESPONSE := new CRESPONSE;
THE FIRST / THE SECOND SOLUTION BELOW
END LOOP;
END IF;
I have two solution , the first is to use switch and case But I want to call dynamicly the function if not I have to make 50 case ..
FIRST SOLUTION:
case V_FUNCTION
when 'COUVERTURE_MAGASIN' then v_json_collect.put(V_FUNCTION,COUVERTURE_MAGASIN(i_json_stats));
when 'COUVERTURE_VOLUMES' then v_json_collect.put(V_FUNCTION,COUVERTURE_VOLUMES(i_json_stats));
end case;
SECOND SOLUTION : but I dont know how to insert it in my GETSTAT Function
execute immediate' begin v_json_collect.put(V_FUNCTION,'||V_FUNCTION||'(i_json_stats)); end';
Thanks for help