-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions
More file actions
41 lines (39 loc) · 1008 Bytes
/
functions
File metadata and controls
41 lines (39 loc) · 1008 Bytes
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
1---------------------------------------------------------
--This functions checks returns well-doing teams
CREATE OR REPLACE FUNCTION TOP_TEAMS(TOP number)
RETURN NUMBER
AS
BEGIN
IF TOP < 50 THEN
RETURN TOP;
END IF;
END;
/
select TEAM_WINS, TOP_TEAMS(TEAM_WINS)
from TEAMS;
2---------------------------------------------------------
--This function returns the list of the currently logged in clients
CREATE OR REPLACE FUNCTION ACTIVE_USERS(ACTIVE number)
RETURN NUMBER
AS
BEGIN
IF ACTIVE = 1 THEN
RETURN ACTIVE;
END IF;
END;
/
select CURRENTLY_ACTIVE, ACTIVE_USERS(CURRENTLY_ACTIVE)
from USER_PRIVACY;
3---------------------------------------------------------
--This functions prints the list of the offers that are still pending
CREATE OR REPLACE FUNCTION INPROGRESS_OFFERS(OFFER number)
RETURN NUMBER
AS
BEGIN
IF OFFER = 0 THEN
RETURN OFFER;
END IF;
END;
/
select ACCEPTDECLINE, INPROGRESS_OFFERS(ACCEPTDECLINE)
from TRADE;