美文网首页
数据库函数

数据库函数

作者: rollAway | 来源:发表于2016-06-22 16:21 被阅读11次

感觉这个方法在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;

相关文章

  • [1172] Result consisted of more

    数据库函数查询对应多条数据

  • 八.Excel数据库函数

    八.Excel数据库函数 1.数据库函数 DAVERAGE计算列表或数据库的字段中满足指定条件的值的平均值 DCO...

  • 数据库函数

    MySQL数据库 1.字符函数、2.数值运算符与函数、3.比较运算符与函数、4日期时间函数、5.信息函数、...

  • 数据库函数

    感觉这个方法在java中实现有点复杂,遂在oracle中实现。 CREATE OR REPLACE FUNCTIO...

  • 第五章

    18.1.2~18.1.4 [TOC] 第五章:C函数 数学库函数 下图给出一些常用的数学库函数,x和y的数据类型...

  • jpa常用方法

    jpa使用specification调用数据库函数。例如调用postgresql中to_char(timestam...

  • stdio库函数与系统调用(open, write, read)

    stdio库函数与系统调用在缓冲区上的区别 stdio库函数有自己的数据缓冲区来减少系统调用,这个缓冲区位于用户态...

  • MySQL数据库函数

    1. 数字类 例题: 2. 字符串类 例题: 3. 时间类 4. 加密函数 5 判断函数 语法: 例题:

  • SqlServer数据库函数

    使用时别忘了加dbo,否则报错

  • stm8s--eeprom

    要点,擦除数据就是写入0 1.寄存器操作 2库函数操作

网友评论

      本文标题:数据库函数

      本文链接:https://www.haomeiwen.com/subject/mylpdttx.html