oracle 函数 转 mysql,关于oracle和mysql function函数转变有关问题

SQL code// 想将下面的转为mysql的,求各位帮帮忙,非常感谢!!在线等,我先去恶补下SQL的函数知识,希望等会能有好心人的回答~~

create or replace function getFiberStatus(in_stationid in varchar2, -- 局站标识

in_markid in varchar2, -- 地标标识

in_segmentid in varchar2, -- 光缆段标识

in_fiberid in varchar2) -- 光纤标识

return integer is

v_count integer := 0;

begin

-- 是否被光纤连接占用

select count(*)

into v_count

from fams_fiberconnection

where decode(stationid, in_stationid, 1, 0) = 1

and decode(markid, in_markid, 1, 0) = 1

and ((asegmentid = in_segmentid and afiberid = in_fiberid) or

(zsegmentid = in_segmentid and zfiberid = in_fiberid));

if v_count > 0 then

return 1;

end if;

-- 是否被分光器占用

select count(*)

into v_count

from fams_splitter

where decode(stationid, in_stationid, 1, 0) = 1

and decode(markid, in_markid, 1, 0) = 1

and segmentid = in_segmentid

and fiberid = in_fiberid;

if v_count > 0 then

return 1;

end if;

-- 是否被分光器连接占用

select count(*)

into v_count

from fams_splitter s, fams_splitterconnection sc

where decode(stationid, in_stationid, 1, 0) = 1

and decode(markid, in_markid, 1, 0) = 1

and s.splitterid = sc.splitterid

and sc.segmentid = in_segmentid

and sc.fiberid = in_fiberid;

if v_count > 0 then

return 1;

end if;

-- 是否被光开关连接占用

select count(*)

into v_count

from fams_rtu r, fams_oswconnection oc

where r.stationid = in_stationid

and r.rtuid = oc.rtuid

and oc.segmentid = in_segmentid

and oc.fiberid = in_fiberid;

if v_count > 0 then

return 1;

end if;

-- 其它需要补充,否则未被占用状态

return 0;

end getFiberStatus;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值