1 PACKAGE BODY FF_DEL_GLOBAL_PKG as
2 /* $Header: ffglb02t.pkb 120.0 2005/05/27 23:25:30 appldev noship $ */
3 --
4 /*===========================================================================+
5 | Copyright (c) 1993 Oracle Corporation |
6 | Redwood Shores, California, USA |
7 | All rights reserved. |
8 +============================================================================+
9 Name
10 FF_DEL_GLOBAL_PKG
11 Purpose
12 Package used to support delete operations on ff_globals_f.
13 Notes
14
15 History
16 04-04-2001 K.Kawol 115.0 Date created.
17
18 ============================================================================*/
19 TYPE tab_globalid_type IS TABLE OF ff_globals_f.global_id%TYPE
20 INDEX BY BINARY_INTEGER;
21 --
22 g_global_id tab_globalid_type;
23 g_global_ind BINARY_INTEGER;
24 --
25 -----------------------------------------------------------------------------
26 -- Name
27 -- Clear_Count
28 -- Purpose
29 -- Will be used in the Before Delete trigger on table ff_globals_f
30 -- to empty the plsql table.
31 -- Arguments
32 --
33 -- Notes
34 -- None.
35 -----------------------------------------------------------------------------
36 PROCEDURE Clear_Count IS
37 BEGIN
38 g_global_ind := 0;
39 END CLear_count;
40 --
41 -----------------------------------------------------------------------------
42 -- Name
43 -- Add_Global
44 -- Purpose
45 -- Used in the Before Delete row level trigger to add the primary key
46 -- global_id of the record being deleted to the plsql table.
47 -- Arguments
48 -- See below.
49 -- Notes
50 -- None.
51 -----------------------------------------------------------------------------
52 --
53 PROCEDURE Add_Global (p_global_id in ff_globals_f.global_id%TYPE) IS
54 BEGIN
55 g_global_ind := g_global_ind + 1;
56 g_global_id(g_global_ind) := p_global_id;
57 END Add_Global;
58 --
59 -----------------------------------------------------------------------------
60 -- Name
61 -- Delete_User_Entity
62 -- Purpose
63 -- Used in the After Delete statement level trigger on ff_globals_f
64 -- and checks that no rows with the same global id exists before going
65 -- on to delete user_entities and database items.
66 -- Arguments
67 -- See below.
68 -- Notes
69 -- None.
70 -----------------------------------------------------------------------------
71 PROCEDURE Delete_User_Entity IS
72 l_globalid ff_globals_f.global_id%TYPE;
73 no_of_global number;
74 --
75 BEGIN
76 FOR i in 1..g_global_ind LOOP
77 l_globalid := g_global_id(i);
78
79 select count(*)
80 into no_of_global
81 from ff_globals_f
82 where global_id = l_globalid;
83
84 if (no_of_global = 0) then
85 delete from ff_user_entities
86 where creator_id = l_globalid
87 and creator_type = 'S';
88 end if;
89
90 END LOOP;
91 --
92 END Delete_User_Entity;
93 --
94 END FF_DEL_GLOBAL_PKG;