forked from acredjb/FBP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfbp_pre.prc
158 lines (148 loc) · 4.54 KB
/
fbp_pre.prc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
create or replace procedure fbp_pre(ref_count in out number) is
cans number;
y_count number;
n_count number;
res_count number;
r_li number;
r_ms number;
r_inte number;
r_w number;
r_game varchar2(100);
res varchar2(100);
res_y varchar2(100);
res_n varchar2(100);
group_by_count number;
cursor fbp_cur is
select * from fbp_predict;
fbp_rec fbp_predict%rowtype;
begin
cans:=3;
group_by_count := 0;
res_count := 0;
open fbp_cur;
loop
fetch fbp_cur
into fbp_rec;
exit when fbp_cur%notfound;
r_li := fbp_rec.li;
r_ms := fbp_rec.ms;
r_inte := fbp_rec.inte;
r_w :=fbp_rec.w;
r_game := fbp_rec.game_cc;
--li ms inte
fbp_3board_li2ms2in(ref_count,
r_li,
r_ms,
r_inte,
res_count,
res,
group_by_count,
y_count,
res_y,
n_count,
res_n);
if group_by_count = 1 then
if res_count > 2 then --y数量3及以上,n=0;或n数量3及以上,y=0
res := res || to_char(res_count);
update fbp_predict p set p.attr1 = res where p.game_cc = r_game;
commit;
end if;
end if;
if group_by_count = 2 then
res_y := res_y || to_char(y_count);
res_n := res_n || to_char(n_count);
res := res_y || '|' || res_n;
if y_count>cans*n_count or n_count>cans*y_count then
update fbp_predict p set p.attr1 = res where p.game_cc = r_game;
commit;
end if;
end if;
res:='';
--li ms w
fbp_3board_li2ms2w(ref_count,
r_li,
r_ms,
r_w,
res_count,
res,
group_by_count,
y_count,
res_y,
n_count,
res_n);
if group_by_count = 1 then
if res_count > 2 then --y数量3及以上,n=0;或n数量3及以上,y=0
res := res || to_char(res_count);
update fbp_predict p set p.attr2 = res where p.game_cc = r_game;
commit;
end if;
end if;
if group_by_count = 2 then
res_y := res_y || to_char(y_count);
res_n := res_n || to_char(n_count);
res := res_y || '|' || res_n;
if y_count>cans*n_count or n_count>cans*y_count then
update fbp_predict p set p.attr2 = res where p.game_cc = r_game;
commit;
end if;
end if;
res:='';
--li inte w
fbp_3board_li2in2w(ref_count,
r_li,
r_inte,
r_w,
res_count,
res,
group_by_count,
y_count,
res_y,
n_count,
res_n);
if group_by_count = 1 then
if res_count > 2 then --y数量3及以上,n=0;或n数量3及以上,y=0
res := res || to_char(res_count);
update fbp_predict p set p.attr3 = res where p.game_cc = r_game;
commit;
end if;
end if;
if group_by_count = 2 then
res_y := res_y || to_char(y_count);
res_n := res_n || to_char(n_count);
res := res_y || '|' || res_n;
if y_count>cans*n_count or n_count>cans*y_count then
update fbp_predict p set p.attr3 = res where p.game_cc = r_game;
commit;
end if;
end if;
res:='';
-- ms inte w
fbp_3board_ms2in2w(ref_count,
r_ms,
r_inte,
r_w,
res_count,
res,
group_by_count,
y_count,
res_y,
n_count,
res_n);
if group_by_count = 1 then
if res_count > 2 then --y数量3及以上,n=0;或n数量3及以上,y=0
res := res || to_char(res_count);
update fbp_predict p set p.attr4 = res where p.game_cc = r_game;
commit;
end if;
end if;
if group_by_count = 2 then
res_y := res_y || to_char(y_count);
res_n := res_n || to_char(n_count);
res := res_y || '|' || res_n;
if y_count>cans*n_count or n_count>cans*y_count then
update fbp_predict p set p.attr4 = res where p.game_cc = r_game;
commit;
end if;
end if;
end loop;
end fbp_pre;