1 package body iby_avs_code_pkg as
2 /*$Header: ibyavscb.pls 115.3 2002/11/16 00:24:01 jleybovi ship $*/
3
4
5 procedure eval_factor( i_payeeid in varchar2,
6 i_avs_code in varchar2,
7 o_score out nocopy integer )
8 is
9
10 l_score varchar2(10);
11 l_cnt integer;
12 l_payeeid varchar2(80);
13
14 cursor c_get_factor_config(ci_payeeid varchar2, ci_avs_code varchar2)
15 is
16 select value
17 from iby_mappings
18 where ( ( payeeid is null and ci_payeeid is null ) or
19 payeeid = ci_payeeid)
20 and mapping_type = 'AVS_CODE_TYPE'
21 and mapping_code = ci_avs_code;
22
23 begin
24
25 /*
26 ** check whether this payeeid has any entry in
27 ** for AVScodes.
28 ** if not the set payeeid to null.
29 */
30
31 select count(1) into l_cnt
32 from iby_mappings
33 where mapping_type = 'AVS_CODE_TYPE'
34 and payeeid = i_payeeid;
35
36 if ( l_cnt = 0 ) then
37 l_payeeid := null;
38 else
39 l_payeeid := i_payeeid;
40 end if;
41
42 -- close the cursor if it already open.
43 if ( c_get_factor_config%isopen ) then
44 close c_get_factor_config;
45 end if;
46
47 open c_get_factor_config(l_payeeid, i_avs_code);
48 -- fetch the values
49 fetch c_get_factor_config into l_score;
50 -- if avscode is not present then assign norisk value
51 -- otherwise get the corresponding value by calling
52 -- iby_risk_scores_pkg.getScore method.
53 if ( c_get_factor_config%notfound) then
54 o_score := 0;
55 else
56 o_score := iby_risk_scores_pkg.getScore(i_payeeid, l_score);
57 end if;
58 close c_get_factor_config;
59
60 end eval_factor;
61
62 end iby_avs_code_pkg;