1: function hp_user_quota_max_check_admin (userid IN integer, lesser_mortal_quota IN integer, higher_mortal_quota IN integer)
2: return integer
3: IS
4: quota_max integer;
5: special_count integer;
6: return_value integer;
7: higher_mortal_p integer;
8: BEGIN
9: select count(*) into special_count
10: from users_special_quotas
11: where user_id=userid;
12:
13: select count(*) into higher_mortal_p
14: from user_group_map ugm
15: where ugm.user_id = userid
16: and ugm.group_id = system_administrator_group_id;
17:
18: IF special_count = 0
19: THEN
20: IF higher_mortal_p = 0
21: THEN
22: select (lesser_mortal_quota * power(2,20))
23: into return_value
24: from dual;
25: return return_value;
26: ELSE
27: select (higher_mortal_quota * power(2,20))
28: into return_value
29: from dual;
30: return return_value;
31: END IF;
32: ELSE
33: select max_quota into quota_max
34: from users_special_quotas
35: where user_id=userid;
36: select (quota_max * power(2,20))
37: into return_value
38: from dual;
39: return return_value;
40: END IF;
41: END;
|