大家好,又见面了,我是你们的朋友全栈君。
创建函数的基本格式 create or replace function 函数名称(参数1 ,参数2) return 参数类型 is
create or replace function getPreferentialPrice (priceRet in number,clientId in varchar2,dd_outp_class in varchar2) return number is ret number; type2 varchar2(20); rate number := 1.0; begin select b.DD_FEESOURCE_TYPE into type2 from EHR_CLI_REGISTRY a,EHR_FEESOURCE_ATTR b where a.ehr_id=b.ehr_id and a.CLIENT_ID=clientId ; if type2 = ‘2’ then if dd_outp_class = ’05’ then rate := 0.9 ; elsif dd_outp_class = ’08’ then rate := 0.95 ; elsif dd_outp_class = ’11’ then rate := 0.5 ; end if; end if; ret := priceRet*rate; return (to_char(ret,’9999999990.99′) ); end getPreferentialPrice;
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/160741.html原文链接:https://javaforall.cn