forked from acredjb/FBP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfbp_3board.prc
67 lines (65 loc) · 2.36 KB
/
fbp_3board.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
create or replace procedure fbp_3board(ref_count in number,
a in number,
b in number,
c in number,
res_count out number,
res out varchar2,
group_by_count out number,
y_count out number,
res_y out varchar2,
n_count out number,
res_n out varchar2) is
begin
--共有1行或2行
select count(*)
into group_by_count
from (SELECT count(gameresult), gameresult
FROM (select *
from fbp_pl
where rownum < ref_count
order by game_cc desc) p
WHERE p.li = a
and p.ms = b
and p.inte = c
group by gameresult);
if group_by_count =1 then
SELECT count(gameresult), gameresult
into res_count, res
FROM (select *
from fbp_pl
where rownum < ref_count
order by game_cc desc) p
WHERE p.li = a
and p.ms = b
and p.inte = c
group by gameresult;
end if;
if group_by_count = 2 then
--有两行时,y的数量
select q.c, q.r
into y_count, res_y
from (SELECT count(gameresult) c, gameresult r
FROM (select *
from fbp_pl
where rownum < ref_count
order by game_cc desc) p
WHERE p.li = a
and p.ms = b
and p.inte = c
group by gameresult) q
where q.r = 'y';
--有两行时,n的数量
select q.c, q.r
into n_count, res_n
from (SELECT count(gameresult) c, gameresult r
FROM (select *
from fbp_pl
where rownum < ref_count
order by game_cc desc) p
WHERE p.li = a
and p.ms = b
and p.inte = c
group by gameresult) q
where q.r = 'n';
end if;
end fbp_3board;