DBA Data[Home] [Help]

PACKAGE BODY: APPS.CN_OBJ_TABLES_PKG

Source


1 PACKAGE BODY cn_obj_tables_pkg AS
2 -- $Header: cnobjtbb.pls 120.1 2005/08/08 04:49:54 rramakri noship $
3 
4 /*
5 Date	  Name	     	        Description
6 ---------------------------------------------------------------------------+
7 11-FEB-99 Venkatachalam Krishnan Created
8 
9   Name	  :  cn_ext_tbl_mapping_pkg
10   Purpose : Holds all server side packages used to insert /Delete/Update
11             view CN_TABLE_MAPPINGS
12 
13   Desc    : Begin-Record is the Start Procedure
14 */
15 
16 
17 
18 -- Lock Record Fired in the form is Handled
19 --
20 --
21 PROCEDURE  lock_record  ( p_object_id IN NUMBER
22                         ) IS
23    CURSOR C IS
24       SELECT *
25       FROM  cn_objects
26       WHERE  object_id  = p_object_id
27       FOR UPDATE OF object_id NOWAIT;
28 
29    Recinfo C%ROWTYPE;
30 BEGIN
31    OPEN C;
32    Fetch C into Recinfo;
33 
34    if( C%NOTFOUND )then
35      CLOSE C;
36    end if;
37 
38    CLOSE C;
39    if (Recinfo.object_id = p_object_id )then
40       return;
41   else
42          fnd_message.Set_Name ( 'FND', 'FORM_RECORD_CHANGED');
43          app_exception.raise_exception;
44   end if;
45 END lock_record ;
46 --
47 --
48 --
49 PROCEDURE update_record (
50 			  p_object_id                  IN NUMBER
51 			, p_name                       IN VARCHAR2
52 			, p_description                IN VARCHAR2
53 			, p_dependency_map_complete    IN VARCHAR2
54 			, p_status                     IN VARCHAR2
55 			, p_repository_id              IN NUMBER
56 			, p_alias                      IN VARCHAR2
57 			, p_table_level                IN VARCHAR2
58 			, p_table_type                 IN VARCHAR2
59 			, p_object_type                IN VARCHAR2
60 			, p_schema                     IN VARCHAR2
61 			, p_calc_eligible_flag         IN VARCHAR2
62 			, p_user_name                  IN VARCHAR2
63 			, x_object_version_no          IN OUT NOCOPY NUMBER
64 			, p_org_id                     IN NUMBER
65                        )
66   IS
67 BEGIN
68    x_object_version_no:=x_object_version_no+1;
69    UPDATE cn_objects SET
70        name                          =   p_name
71      , description                   =   p_description
72      , dependency_map_complete       =   p_dependency_map_complete
73      , object_status                 =   p_status
74      , repository_id                 =   p_repository_id
75      , alias                         =   p_alias
76      , table_level                   =   p_table_level
77      , table_type                    =   p_table_type
78      , object_type                   =   p_object_type
79      , schema                        =   p_schema
80      , calc_eligible_flag            =   p_calc_eligible_flag
81      , user_name                     =   p_user_name
82      , object_version_number         =   x_object_version_no
83      WHERE object_id                 =   p_object_id and org_id=p_org_id;
84 END update_record ;
85 --
86 --
87 --
88 
89 PROCEDURE insert_record(
90 			  p_object_id                  IN NUMBER
91 			, p_name                       IN VARCHAR2
92 			, p_description                IN VARCHAR2
93 			, p_dependency_map_complete    IN VARCHAR2
94 			, p_status                     IN VARCHAR2
95 			, p_repository_id              IN NUMBER
96 			, p_alias                      IN VARCHAR2
97 			, p_table_level                IN VARCHAR2
98 			, p_table_type                 IN VARCHAR2
99 			, p_object_type                IN VARCHAR2
100 			, p_schema                     IN VARCHAR2
101 			, p_calc_eligible_flag         IN VARCHAR2
102 			, p_user_name                  IN VARCHAR2
103 		        , p_data_type                  IN VARCHAR2
104 			, p_data_length                IN NUMBER
105 			, p_calc_formula_flag          IN VARCHAR2
106 			, p_table_id                   IN NUMBER
107 			, p_column_datatype            IN VARCHAR2
108 			, x_object_version_number      IN OUT NOCOPY NUMBER
109 			, p_org_id		       IN NUMBER
110                        )
111   IS
112 BEGIN
113    INSERT INTO     cn_objects (
114 			    object_id
115 			  , name
116 			  , description
117 			  , dependency_map_complete
118 			  , object_status
119 			  , repository_id
120 			  , alias
121 			  , table_level
122 			  , table_type
123 			  , object_type
124 			  , schema
125 			  , calc_eligible_flag
126 			  , user_name
127 			  , data_length
128 			  , data_type
129 			  , calc_formula_flag
130 			  , table_id
131 			  , column_datatype
132 			  , object_version_number
133 			  , org_id
134 			       )
135      VALUES  (
136 			    p_object_id
137 			  , p_name
138 			  , p_description
139 			  , P_dependency_map_complete
140 			  , p_status
141 			  , p_repository_id
142 			  , p_alias
143 			  , p_table_level
144 			  , p_table_type
145 			  , p_object_type
146 			  , p_schema
147 			  , p_calc_eligible_flag
148 	                  , p_user_name
149 	                  , p_data_length
150 	                  , p_data_type
151 	                  , p_calc_formula_flag
152 	                  , p_table_id
153 	                  , p_column_datatype
154 			  , x_object_version_number
155 			  , p_org_id
156 	      );
157 END insert_record;
158 
159 --
160 --
161 
162 PROCEDURE  begin_record(
163 		       	  p_operation                  IN VARCHAR2
164 			, p_object_id                  IN NUMBER
165 			, p_name                       IN VARCHAR2
166 			, p_description                IN VARCHAR2
167 			, p_dependency_map_complete    IN VARCHAR2
168 			, p_status                     IN VARCHAR2
169 			, p_repository_id              IN NUMBER
170 			, p_alias                      IN VARCHAR2
171 			, p_table_level                IN VARCHAR2
172 			, p_table_type                 IN VARCHAR2
173 			, p_object_type                IN VARCHAR2
174 			, p_schema                     IN VARCHAR2
175 			, p_calc_eligible_flag         IN VARCHAR2
176 			, p_user_name                  IN VARCHAR2
177 		        , p_data_type                  IN VARCHAR2
178 			, p_data_length                IN NUMBER
179 			, p_calc_formula_flag          IN VARCHAR2
180 			, p_table_id                   IN NUMBER
181 		        , p_column_datatype            IN VARCHAR2
182 			, x_object_version_number      IN OUT NOCOPY NUMBER
183 			, p_org_id                     IN NUMBER
184 			)
185   IS
186 BEGIN
187    IF p_operation = 'INSERT' THEN
188            insert_record (
189 			    p_object_id
190 			  , p_name
191 			  , p_description
192 			  , P_dependency_map_complete
193 			  , p_status
194 			  , p_repository_id
195 			  , p_alias
196 			  , p_table_level
197 			  , p_table_type
198 			  , p_object_type
199 			  , p_schema
200 			  , p_calc_eligible_flag
201 			  , p_user_name
202 			  , p_data_type
203 			  , p_data_length
204 			  , p_calc_formula_flag
205 			  , p_table_id
206 			  , p_column_datatype
207 			  , x_object_version_number
208 			  , p_org_id
209 			  );
210 
211 
212     ELSIF p_operation = 'UPDATE' THEN
213           update_record  (
214                             p_object_id
215 			  , p_name
216 			  , p_description
217 			  , P_dependency_map_complete
218 			  , p_status
219 			  , p_repository_id
220 			  , p_alias
221 			  , p_table_level
222 			  , p_table_type
223 			  , p_object_type
224 			  , p_schema
225 			  , p_calc_eligible_flag
226 			  , p_user_name
227 			  , x_object_version_number
228 			  , p_org_id
229 			  );
230     ELSIF p_operation = 'LOCK' THEN
231          lock_record ( p_object_id );
232    END IF;
233 END begin_record ;
234 --
235 --
236 --
237 END cn_obj_tables_pkg;