Home > Database > Mysql Tutorial > oracle自定义函数如何转成mysql函数

oracle自定义函数如何转成mysql函数

WBOY
Release: 2016-06-06 09:34:33
Original
1806 people have browsed it

mysqloracle函数

这是oracle自定义的函数,怎么把他转成mysql的
create or replace function fun_return_zjxl(in_taskId varchar2,
in_work_no varchar2)
return varchar2 is
v_sum number(10);--质检平均完成量
v_num NUMBER(10);--质检个人完成量
v_qualitied_cnt NUMBER(10);
v_result varchar2(20);--0异常,1高于平均值,2低于平均值
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;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template