Home > database >  Mysql in the custom function how to call the custom function definition in the table?
Mysql in the custom function how to call the custom function definition in the table?

Time:10-22

1, the function defines each indicators in the table



2, the stored procedure need statistical data: every index of the
DECLARE v_label_code VARCHAR (50);
DECLARE v_label_value VARCHAR (125);
DECLARE v_calc_function VARCHAR (125);
DECLARE v_func_param VARCHAR (50);
DECLARE over INT the DEFAULT FALSE;
DECLARE feature_cursor CURSOR FOR the SELECT label_code calc_function, func_param FROM feature_define WHERE status=1 and Id=1;

DECLARE the CONTINUE HANDLER FOR the NOT FOUND SET over=TRUE;

The OPEN feature_cursor;
Loop_1: LOOP
The FETCH feature_cursor INTO v_label_code, v_calc_function v_func_param;
IF over THEN
LEAVE loop_1;
END
IF;

SELECT CONCAT (v_calc_function, '(', v_func_param,') ') INTO v_label_value;

The SELECT v_label_code;
The SELECT v_label_value;
END
LOOP
Loop_1;
The CLOSE feature_cursor;

3, the actual call results returned is a string, rather than a function call


Can you tell me how to solve?
  • Related