oracle 函式應用實踐一

2021-05-27 08:00:48 字數 1336 閱讀 9029

create or replace function f_get_fjkywtce(fcd in varchar, flag in number)

--非集客業務提成額(不參與考核分配)

return number

is prekpi number;

p1 number;

p2 number;

p3 number;

begin

if flag = 0 --住宅**攬裝

then

select sum(oc.commision) into p1 from o_canvass oc

where oc.fixednet_cd = fcd group by oc.fixednet_cd;

return p1;

end if;

if flag = 1 --住宅寬頻新裝提成

then

select sum(h.commision) into p2 from o_new_home_broad h

where h.fixednet_cd = fcd group by h.fixednet_cd;

return p2;

end if;

if flag = 2 --住宅寬頻續費提成

then

select sum(rh.commision) into p3 from o_renew_home_broad rh

where rh.fixednet_cd = fcd group by rh.fixednet_cd;

return p3;

end if;

if flag = 3 --非集客業務提成小計

then

select sum(oc.commision) into p1 from o_canvass oc

where oc.fixednet_cd = fcd group by oc.fixednet_cd;

select sum(h.commision) into p2 from o_new_home_broad h

where h.fixednet_cd = fcd group by h.fixednet_cd;

select sum(rh.commision) into p3 from o_renew_home_broad rh

where rh.fixednet_cd = fcd group by rh.fixednet_cd;

prekpi := p1+p2+p3;

return prekpi;

end if;

end f_get_fjkywtce;

函式計算實踐 乙個應用案例

來自乙個使用者匹配的需求。使用者的不同資訊分布於兩個系統,且客觀上無法直接打通。所以就涉及到兩個系統id匹配的問題。先抽象問題 系統a,系統b 系統a中存在乙個使用者a 字段 a id,a img,a name 系統b中可能有a的補充資訊 字段 ab id,ab img,ab name 目標 如果b...

Git應用實踐(一)

近期在使用git oschina上發現以下兩個問題 直接搜尋上述關鍵字,可以很快找到解決方案。這裡僅作備忘。檢視使用者名稱及提交郵箱 git config user.name git config user.email 修改使用者名稱及提交郵箱 git config user.name abc gi...

oracle 函式的應用

返回日期型 create or replace function getplandate v date in date,v cnt in number 傳入當前時間,期數 return date asy number m number d number last cnt date date last...