create or replace function ft_getintrate( as_coopid char , as_lnintcode char , adc_money number , adtm_operate date ) return number is ldc_intrate number; begin if as_coopid is null or as_lnintcode is null or adc_money is null or adtm_operate is null then return 0.00; end if; select nvl( interest_rate , 0 ) as interest_rate into ldc_intrate from lncfloanintratedet where coop_id = as_coopid and loanintrate_code = as_lnintcode and adtm_operate between effective_date and expire_date and adc_money between lower_amt and upper_amt; return ldc_intrate; end;