数据库函数

2016-06-22  本文已影响11人  rollAway

感觉这个方法在java中实现有点复杂,遂在oracle中实现。

CREATE OR REPLACE FUNCTION "GETI10016" (

pi_aac001   number

) return number as

ln_retage   number;

bac078t varchar2(2);

bac079t number;

bac081t varchar2(2);

bac082t number;

bia001t number;

aac218t number;

begin

select bac078 into bac078t from ic10 t where t.aac001 = pi_aac001;

select bac079 into bac079t from ic10 t where t.aac001 = pi_aac001;

select bac081 into bac081t from ic10 t where t.aac001 = pi_aac001;

select bac082 into bac082t from ic10 t where t.aac001 = pi_aac001;

select bia001 into bia001t from ic10 t where t.aac001 = pi_aac001;

select aac218 into aac218t from ic10 t where t.aac001 = pi_aac001;

if bac078t is not null then

if bac078t = '01' or bac078t = '02'  then

bac079t :=  bac079t*bia001t;

end if;

else

bac079t := 0;

end if;

if bac081t is not null then

if bac081t = '01'or bac081t = '02'  then

bac082t :=  bac082t*bia001t;

end if;

else

bac082t := 0;

end if;

if aac218t is not null then

aac218t := aac218t*bia001t;

end if;

ln_retage := bac079t+aac218t+bac082t;

return ln_retage;

end;

上一篇 下一篇

猜你喜欢

热点阅读