[Home] [Help]
PACKAGE BODY: APPS.GL_STORAGE_PARAMETERS_PKG
Source
1 PACKAGE BODY gl_storage_parameters_pkg AS
2 /* $Header: glistpab.pls 120.8 2005/05/05 01:23:50 kvora ship $ */
3
4 --
5 -- PUBLIC FUNCTIONS
6 --
7
8 PROCEDURE check_unique(X_object_name VARCHAR2,
9 X_row_id VARCHAR2) IS
10 CURSOR chk_duplicates is
11 SELECT 'Duplicate'
12 FROM GL_STORAGE_PARAMETERS s
13 WHERE s.object_name = X_object_name
14 AND ( X_row_id is null
15 OR s.rowid <> chartorowid(X_row_id));
16 dummy VARCHAR2(100);
17 BEGIN
18 OPEN chk_duplicates;
19 FETCH chk_duplicates INTO dummy;
20
21 IF chk_duplicates%FOUND THEN
22 CLOSE chk_duplicates;
23 fnd_message.set_name('SQLGL', 'GL_DUPLICATE_STORAGE_PARAMETER');
24 app_exception.raise_exception;
25 END IF;
26
27 CLOSE chk_duplicates;
28
29 EXCEPTION
30 WHEN app_exceptions.application_exception THEN
31 RAISE;
32 WHEN OTHERS THEN
33 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
34 fnd_message.set_token('PROCEDURE', 'gl_storage_parameters_pkg.check_unique');
35 RAISE;
36 END check_unique;
37
38
39 PROCEDURE Insert_Row( X_Rowid IN OUT NOCOPY VARCHAR2,
40 X_object_name VARCHAR2,
41 X_last_update_date DATE,
42 X_last_updated_by NUMBER,
43 X_creation_date DATE,
44 X_created_by NUMBER,
45 X_last_update_login NUMBER,
46 X_object_type VARCHAR2,
47 X_tablespace_name VARCHAR2,
48 X_initial_extent_size_kb NUMBER,
49 X_next_extent_size_kb NUMBER,
50 X_max_extents NUMBER,
51 X_pct_increase NUMBER,
52 X_pct_free NUMBER,
53 X_description VARCHAR2) IS
54 CURSOR C IS SELECT rowid FROM GL_STORAGE_PARAMETERS
55 WHERE object_name = X_object_name;
56 BEGIN
57
58 INSERT INTO GL_STORAGE_PARAMETERS( OBJECT_NAME,
59 LAST_UPDATE_DATE,
60 LAST_UPDATED_BY,
61 CREATION_DATE,
62 CREATED_BY,
63 LAST_UPDATE_LOGIN,
64 OBJECT_TYPE,
65 TABLESPACE_NAME,
66 INITIAL_EXTENT_SIZE_KB,
67 NEXT_EXTENT_SIZE_KB,
68 MAX_EXTENTS,
69 PCT_INCREASE,
70 PCT_FREE,
71 DESCRIPTION)
72 VALUES (X_object_name,
73 X_last_update_date,
74 X_last_updated_by,
75 X_creation_date,
76 X_created_by,
77 X_last_update_login,
78 X_object_type,
79 X_tablespace_name,
80 X_initial_extent_size_kb,
81 X_next_extent_size_kb,
82 X_max_extents,
83 X_pct_increase,
84 X_pct_free,
85 X_description);
86 OPEN C;
87 FETCH C INTO X_Rowid;
88 if (C%NOTFOUND) then
89 CLOSE C;
90 RAISE NO_DATA_FOUND;
91 end if;
92 CLOSE C;
93 END Insert_Row;
94
95
96 PROCEDURE Lock_Row( X_Rowid IN OUT NOCOPY VARCHAR2,
97 X_object_name VARCHAR2,
98 X_object_type VARCHAR2,
99 X_tablespace_name VARCHAR2,
100 X_initial_extent_size_kb NUMBER,
101 X_next_extent_size_kb NUMBER,
102 X_max_extents NUMBER,
103 X_pct_increase NUMBER,
104 X_pct_free NUMBER,
105 X_description VARCHAR2) IS
106 CURSOR C IS
107 SELECT * FROM GL_STORAGE_PARAMETERS
108 WHERE rowid = X_rowid
109 FOR UPDATE OF object_name NOWAIT;
110 Recinfo C%ROWTYPE;
111 BEGIN
112 OPEN C;
113 FETCH C INTO Recinfo;
114 if (C%NOTFOUND) then
115 CLOSE C;
116 FND_MESSAGE.SET_NAME('FND', 'FORM_RECORD_DELETED');
117 APP_EXCEPTION.RAISE_EXCEPTION;
118 end if;
119 CLOSE C;
120 IF ( ( ( (Recinfo.object_name = X_object_name )
121 OR ( (Recinfo.object_name IS NULL)
122 AND (X_object_name IS NULL))))
123 AND
124 ( ( (Recinfo.object_type = X_object_type )
125 OR ( (Recinfo.object_type IS NULL)
126 AND (X_object_type IS NULL))))
127 AND
128 ( ( (Recinfo.tablespace_name = X_tablespace_name)
129 OR ( (Recinfo.tablespace_name IS NULL)
130 AND (X_tablespace_name IS NULL))))
131 AND
132 ( ( (Recinfo.initial_extent_size_kb = X_initial_extent_size_kb )
133 OR ( (Recinfo.initial_extent_size_kb IS NULL)
134 AND (X_initial_extent_size_kb IS NULL))))
135 AND
136 ( ( (Recinfo.next_extent_size_kb = X_next_extent_size_kb )
137 OR ( (Recinfo.next_extent_size_kb IS NULL)
138 AND (X_next_extent_size_kb IS NULL))))
139 AND
140 ( ( (Recinfo.max_extents = X_max_extents )
141 OR ( (Recinfo.max_extents IS NULL)
142 AND (X_max_extents IS NULL))))
143 AND
144 ( ( (Recinfo.pct_increase = X_pct_increase )
145 OR ( (Recinfo.pct_increase IS NULL)
146 AND (X_pct_increase IS NULL))))
147 AND
148 ( ( (Recinfo.pct_free = X_pct_free )
149 OR ( (Recinfo.pct_free IS NULL)
150 AND (X_pct_free IS NULL))))
151 AND
152 ( ( (Recinfo.description = X_description )
153 OR ( (Recinfo.description IS NULL)
154 AND (X_description IS NULL))))) THEN
155 return;
156 ELSE
157 FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
158 APP_EXCEPTION.RAISE_EXCEPTION;
159 end if;
160 END Lock_Row;
161
162
163 PROCEDURE Update_Row( X_Rowid IN OUT NOCOPY VARCHAR2,
164 X_object_name VARCHAR2,
165 X_last_update_date DATE,
166 X_last_updated_by NUMBER,
167 X_creation_date DATE,
168 X_created_by NUMBER,
169 X_last_update_login NUMBER,
170 X_object_type VARCHAR2,
171 X_tablespace_name VARCHAR2,
172 X_initial_extent_size_kb NUMBER,
173 X_next_extent_size_kb NUMBER,
174 X_max_extents NUMBER,
175 X_pct_increase NUMBER,
176 X_pct_free NUMBER,
177 X_description VARCHAR2) IS
178 BEGIN
179 UPDATE GL_STORAGE_PARAMETERS
180 SET
181 object_name = x_object_name,
182 last_update_date = x_last_update_date,
183 last_updated_by = x_last_updated_by,
184 creation_date = x_creation_date,
185 created_by = x_created_by,
186 last_update_login = x_last_update_login,
187 object_type = x_object_type,
188 tablespace_name = x_tablespace_name,
189 initial_extent_size_kb = x_initial_extent_size_kb,
190 next_extent_size_kb = x_next_extent_size_kb,
191 max_extents = x_max_extents,
192 pct_increase = x_pct_increase,
193 pct_free = x_pct_free,
194 description = x_description
195 WHERE
196 rowid = x_rowid;
197 if (SQL%NOTFOUND) then
198 RAISE NO_DATA_FOUND;
199 end if;
200
201 END Update_Row;
202
203 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
204 BEGIN
205 DELETE FROM GL_STORAGE_PARAMETERS
206 WHERE rowid = X_Rowid;
207
208 if (SQL%NOTFOUND) then
209 RAISE NO_DATA_FOUND;
210 end if;
211 END Delete_Row;
212
213 Procedure load_row(
214 x_object_name in out NOCOPY varchar2,
215 x_object_type in varchar2,
216 x_tablespace_name in varchar2,
217 x_initial_extent_size_kb in number,
218 x_next_extent_size_kb in number,
219 x_max_extents in number,
220 x_pct_increase in number,
221 x_description in varchar2,
222 x_pct_free in number,
223 x_owner in varchar2,
224 x_force_edits in varchar2
225 ) as
226 user_id number := 0;
227 v_creation_date date;
228 v_rowid rowid := null;
229 v_language varchar2(4) := null;
230 v_source_lang varchar2(4) := null;
231
232 begin
233
234 -- validate input parameters
235 if ( x_object_name is null ) Then
236 fnd_message.set_name('SQLGL', 'GL_LOAD_ROW_NO_DATA');
237 app_exception.raise_exception;
238 end if;
239
240 if (X_OWNER = 'CUSTOM') then
241 user_id := -1;
242 else
243 user_id := FND_LOAD_UTIL.owner_id(X_OWNER);
244 end if;
245
246 /* Update/Insert only if force_edits is 'Y' or user_id is 1 or 2 */
247 if ( user_id IN (1,2) OR x_force_edits = 'Y' ) then
248 begin
249 /* Check if the row exists in the database. If it does, retrieves
250 the creation date for update_row. */
251
252 select creation_date,rowid
253 into v_creation_date, v_rowid
254 from gl_storage_parameters
255 where object_name = x_object_name;
256
257 gl_storage_parameters_pkg.update_row (
258 x_rowid => v_rowid,
259 x_object_name => x_object_name,
260 x_last_update_date => sysdate,
261 x_last_updated_by => user_id,
262 x_creation_date => v_creation_date,
263 x_created_by => user_id,
264 x_last_update_login => 0,
265 x_object_type => x_object_type,
266 x_tablespace_name => x_tablespace_name ,
267 x_initial_extent_size_kb => x_initial_extent_size_kb,
268 x_next_extent_size_kb => x_next_extent_size_kb,
269 x_max_extents => x_max_extents,
270 x_pct_increase => x_pct_increase,
271 x_pct_free => x_pct_free,
272 x_description => x_description
273 );
274
275 exception
276 when NO_DATA_FOUND then
277 gl_storage_parameters_pkg.insert_row (
278 x_rowid => v_rowid ,
279 x_object_name => x_object_name,
280 x_last_update_date => sysdate,
281 x_last_updated_by => user_id,
282 x_creation_date => sysdate,
283 x_created_by => user_id,
284 x_last_update_login => 0,
285 x_object_type => x_object_type,
286 x_tablespace_name => x_tablespace_name ,
287 x_initial_extent_size_kb => x_initial_extent_size_kb,
288 x_next_extent_size_kb => x_next_extent_size_kb,
289 x_max_extents => x_max_extents,
290 x_pct_increase => x_pct_increase,
291 x_pct_free => x_pct_free,
292 x_description => x_description
293 );
294 end;
295 end if;
296 end load_row ;
297
298 Procedure translate_row (
299 x_object_name in varchar2,
300 x_description in varchar2,
301 x_owner in varchar2,
302 x_force_edits in varchar2
303 ) as
304 user_id number := 0;
305 begin
306
307 if (X_OWNER = 'CUSTOM') then
308 user_id := -1;
309 else
310 user_id := FND_LOAD_UTIL.owner_id(X_OWNER);
311 end if;
312
313 /* Update only if force_edits is 'Y' or if user id is 1 or 2 */
314 if ( user_id IN (1,2) OR x_force_edits = 'Y' ) then
315 UPDATE gl_storage_parameters
316 SET
317 description = x_description,
318 last_update_date = sysdate,
319 last_updated_by = user_id,
320 last_update_login = 0
321 WHERE object_name = x_object_name
322 AND USERENV('LANG') =
323 ( SELECT language_code
324 FROM FND_LANGUAGES
325 WHERE installed_flag = 'B' );
326
327 end if;
328
329 /* If base language is not set to the language being uploaded, then do nothing.
330 if (sql%notfound) then
331 raise no_data_found;
332 end if;
333 */
334
335 end translate_row ;
336
337 END gl_storage_parameters_pkg;