This is an oracle-defined function. how can we convert it to mysql worker (in_taskIdvarchar2, in_work_novarchar2) returnvarchar2isv_sumnumber (10); -- Average quality inspection completion quantity v_numNUMBER (10 ); -- individual QC completion quantity v_qualitied_cntNUMBER (10); v_resultvarchar2 (20); -- 0 exception, 1 is higher than the average... mysqloracle functions
This is a custom oracle function. how can I convert it to mysql?
Create or replace function fun_return_zjxl (in_taskId varchar2,
In_work_no varchar2)
Return varchar2 is
V_sum number (10); -- Average quality inspection completion volume
V_num NUMBER (10); -- quantity of individual QC completions
V_qualitied_cnt NUMBER (10 );
V_result varchar2 (20); -- 0 exception, 1 is higher than average, 2 is lower than average
Begin
V_result: = 0;
Select (SELECT count (*) FROM ZJ_SCORE zs where zs. TASK_ID = in_taskId and zs. status = 3)/(select count (zut. user_id) from zj_user_task zut where zut. task_id = in_taskId) into v_sum from dual;
SELECT count (zs. id) into v_num FROM ZJ_SCORE zs where zs. TASK_ID = in_taskId and zs. status = 3 and zs. work_no = in_work_no;
If (v_num> = v_sum) then
V_result: = 1;
Else
V_result: = 2;
End if;
Return (v_result );
End fun_return_zjxl;