[Home] [Help]
PACKAGE BODY: APPS.FND_UMS_LOADER
Source
1 package body fnd_ums_loader as
2 /* $Header: AFUMSLDB.pls 115.37 2004/09/20 23:07:15 golgun noship $ */
3
4 -- ==================================================
5 -- Constants and Types.
6 -- ==================================================
7
8 G_STD_DATE_MASK constant varchar2(100) := 'YYYY/MM/DD HH24:MI:SS';
9
10 DEBUG_OFF constant varchar2(10) := 'N';
11 DEBUG_ON constant varchar2(10) := 'Y';
12 DEBUG_STATS constant varchar2(10) := 'S';
13 DEBUG_ABORT constant varchar2(10) := 'A';
14
15 g_debug_flag varchar2(10);
16 g_newline varchar2(10);
17 g_default_date date;
18
19 --
20 -- lock life and wait times in terms of seconds
21 --
22 g_lock_lifetime integer := 1*24*60*60; -- one day
23 g_lock_waittime integer := 5*60; -- five minutes
24
25 g_bugfix_guid fnd_ums_bugfixes.bugfix_guid%type;
26
27 -- Prereqs/Includes/Links data level
28
29 PIL_LEVEL_NONE constant integer := 0;
30 PIL_LEVEL_PREREQS_INCLUDES constant integer := 1;
31 PIL_LEVEL_LINKS constant integer := 2;
32
33 -- Unknown data
34
35 NOT_AVAILABLE constant varchar2(10) := 'N/A';
36
37 -- UMS tables will be analyzed if
38 -- - analyze hasn't been run for more than TABLE_ANALYZE_PERIOD days or
39 -- - percentage of row count change is more than TABLE_ANALYZE_PERCENTAGE
40
41 TABLE_ANALYZE_PERIOD constant number := 28; -- 28 days (4 weeks)
42 TABLE_ANALYZE_PERCENTAGE constant number := 5; -- 5%
43
44 -- Error codes
45
46 ERROR_UNKNOWN_DOWNLOAD_MODE constant number := -20001;
47 ERROR_UNKNOWN_UPLOAD_PHASE constant number := -20002;
48 ERROR_UNABLE_TO_LOCK constant number := -20003;
49 ERROR_ABORT constant number := -20100;
50
51 -- Error Messages
52
53 MSG_ABORT_OLDER constant varchar2(100) := 'Since file data is older, aborted upload of bug ';
54 MSG_ABORT_LEVEL constant varchar2(100) := 'Since database data is at least as complete as file data, aborted upload of bug ';
55
56 type forced_bugfix_lookup is table of varchar2(1) index by binary_integer;
57
58 type data_contents is record
59 (download_mode varchar2(30),
60 last_definition_date date,
61 last_update_date date,
62 has_bugfix_replacement boolean,
63 pil_level integer,
64 has_files boolean,
65 download_code varchar2(30));
66
67 type upload_controller is record
68 (upload_bugfix_replacement boolean,
69 upload_prereqs_includes_links boolean,
70 upload_files boolean);
71
72 type row_counts is record
73 (bugfixes number,
74 bugfix_relationships number,
75 files number,
76 file_versions number,
77 bugfix_file_versions number);
78
79 type ums_table is record
80 (owner_name varchar2(30),
81 table_name varchar2(30),
82 last_analyzed date,
83 num_rows number,
84 delta_num_rows number);
85
86 type ums_tables is table of ums_table index by binary_integer;
87
88 g_uc upload_controller;
89 g_rc row_counts;
90 g_forced_bugfixes forced_bugfix_lookup;
91
92 --------------------------------------------------------------------------------
93 procedure debug(p_debug in varchar2)
94 is
95 begin
96 if (g_debug_flag <> DEBUG_OFF) then
97 fnd_file.put_line(fnd_file.Log, p_debug);
98 end if;
99 exception
100 when others then
101 null;
102 end debug;
103
104 --------------------------------------------------------------------------------
105 procedure debug(p_func_name in varchar2,
106 p_debug in varchar2)
107 is
108 begin
109 if (g_debug_flag <> DEBUG_OFF) then
110 fnd_file.put_line
111 (fnd_file.Log,
112 'FUNCTION:' || p_func_name || g_newline ||
113 'DEBUG :' || p_debug || g_newline ||
114 'SYSDATE :' || To_char(Sysdate, G_STD_DATE_MASK));
115 end if;
116 exception
117 when others then
118 null;
119 end debug;
120
121 --------------------------------------------------------------------------------
122 procedure set_debugging(p_debug_flag in varchar2)
123 is
124 l_old_debug_flag varchar2(10);
125 begin
126 l_old_debug_flag := g_debug_flag;
127 g_debug_flag := Nvl(Upper(Substr(p_debug_flag, 1, 1)), DEBUG_OFF);
128 if ((l_old_debug_flag = DEBUG_OFF) and (g_debug_flag = DEBUG_ON)) then
129 debug(' ');
130 debug('Update Management System Loader Debugger');
131 debug(rpad('-', 77, '-'));
132 debug('Sysdate = ' || to_char(sysdate, G_STD_DATE_MASK));
133 debug('Legend: DM: Download Mode. LDD: Last definition Date. LUD: Last Update Date.');
134 debug(' ');
135 end if;
136 exception
137 when others then
138 null;
139 end set_debugging;
140
141 --------------------------------------------------------------------------------
142 -- Locks the entity before insert.
143 -- p_entity_name - name of the entity
144 -- p_key1..3 - primary keys of the entity
145 --------------------------------------------------------------------------------
146 PROCEDURE lock_entity(p_entity_name in varchar2,
147 p_key1 in varchar2 default null,
148 p_key2 in varchar2 default null,
149 p_key3 in varchar2 default null)
150 is
151 l_entity varchar2(32000);
152 l_hash_value number;
153 l_lock_name varchar2(128);
154 l_lock_handle varchar2(128);
155 l_lock_status integer;
156 begin
157 -- Get a unique lock name
158
159 l_entity := 'FND.UMS.' || p_entity_name || '.' ||
160 p_key1 || '.' || p_key2 || '.' || p_key3;
161
162 if (lengthb(l_entity) > 128) then
163 -- lockname cannot be longer than 128 bytes.
164 -- Get a hash value between 1 and 65536.
165 l_hash_value := dbms_utility.get_hash_value(l_entity, 1, 65536);
166 l_lock_name := 'FND.UMS.HASH.' || p_entity_name || '.' || l_hash_value;
167 l_lock_name := substrb(l_lock_name, 1, 128);
168 else
169 l_lock_name := l_entity;
170 end if;
171
172 dbms_lock.allocate_unique(lockname => l_lock_name,
173 lockhandle => l_lock_handle,
174 expiration_secs => g_lock_lifetime);
175
176 l_lock_status := dbms_lock.request(lockhandle => l_lock_handle,
177 lockmode => dbms_lock.x_mode,
178 timeout => g_lock_waittime,
179 release_on_commit => TRUE);
180
181 if (l_lock_status <> 0) then
182 raise_application_error(ERROR_UNABLE_TO_LOCK,
183 'Unable to lock entity : ' || l_entity ||
184 '. dbms_lock.request(' || l_lock_name ||
185 ') returned : ' || l_lock_status);
186 end if;
187 end lock_entity;
188
189 --------------------------------------------------------------------------------
190 -- Analyzes table stats iff
191 -- - analyze hasn't been run for more than TABLE_ANALYZE_PERIOD of time
192 -- - percentage of row count change is more than TABLE_ANALYZE_PERCENTAGE
193 --
194 -- p_ums_table - ums table details
195 --------------------------------------------------------------------------------
196 procedure analyze_table(p_ums_table in ums_table)
197 is
198 l_analyze_needed boolean;
199 begin
200 if (g_debug_flag = DEBUG_STATS) then
201 debug('Owner.Table Name : ' || p_ums_table.owner_name || '.' || p_ums_table.table_name);
202 debug('Number of Data Changes : ' || p_ums_table.delta_num_rows);
203 debug('Last Analyzed Row Count : ' || p_ums_table.num_rows);
204 debug('Last Analyzed Date : ' || to_char(p_ums_table.last_analyzed, G_STD_DATE_MASK));
205 end if;
206
207 l_analyze_needed := false;
208
209 if ((p_ums_table.last_analyzed is null) or
210 (sysdate - p_ums_table.last_analyzed > TABLE_ANALYZE_PERIOD)) then
211
212 if (g_debug_flag = DEBUG_STATS) then
213 debug('Table has not been analyzed for more than TABLE_ANALYZE_PERIOD of ' ||
214 TABLE_ANALYZE_PERIOD || ' days');
215 end if;
216
217 l_analyze_needed := true;
218
219 elsif ((p_ums_table.num_rows is null) or
220 (p_ums_table.delta_num_rows > p_ums_table.num_rows * TABLE_ANALYZE_PERCENTAGE / 100)) then
221
222 if (g_debug_flag = DEBUG_STATS) then
223 debug(p_ums_table.delta_num_rows || ' data changes exceeds the TABLE_ANALYZE_PERCENTAGE of ' ||
224 TABLE_ANALYZE_PERCENTAGE || '%');
225 end if;
226
227 l_analyze_needed := true;
228
229 end if;
230
231 if (l_analyze_needed) then
232
233 fnd_stats.gather_table_stats(p_ums_table.owner_name, p_ums_table.table_name);
234
235 if (g_debug_flag = DEBUG_STATS) then
236 debug('Statistics were successfully gathered.');
237 debug(' ');
238 end if;
239
240 else
241 if (g_debug_flag = DEBUG_STATS) then
242 debug('There is no need to gather statistics.');
243 debug(' ');
244 end if;
245 end if;
246
247 exception
248 when others then
249 if (g_debug_flag = DEBUG_STATS) then
250 debug('analyze_table(''' ||
251 p_ums_table.owner_name || ''', ''' || p_ums_table.table_name || ''') failed.');
252 debug('SQLERRM : ' || sqlerrm);
253 end if;
254 end analyze_table;
255
256 --------------------------------------------------------------------------------
257 -- Gets UMS table details from dba_tables.
258 --------------------------------------------------------------------------------
259 procedure add_table_details(px_ums_tables in out nocopy ums_tables,
260 px_ums_table_count in out nocopy binary_integer,
261 p_table_name in varchar2,
262 p_delta_num_rows in number)
263 is
264 cursor l_applsys_schemas is
265 select fou.oracle_username
266 from fnd_oracle_userid fou,
267 fnd_product_installations fpi
268 where fou.oracle_id = fpi.oracle_id
269 and fpi.application_id = 0;
270
271 cursor l_ums_tables(p_owner in varchar2, p_table_name in varchar2) is
272 select owner, table_name, last_analyzed, num_rows
273 from dba_tables
274 where owner = p_owner
275 and table_name = p_table_name;
276 begin
277 for l_applsys_schema in l_applsys_schemas loop
278 for l_ums_table in l_ums_tables(l_applsys_schema.oracle_username, p_table_name) loop
279
280 px_ums_tables(px_ums_table_count).owner_name := l_ums_table.owner;
281 px_ums_tables(px_ums_table_count).table_name := l_ums_table.table_name;
282 px_ums_tables(px_ums_table_count).last_analyzed := l_ums_table.last_analyzed;
283 px_ums_tables(px_ums_table_count).num_rows := l_ums_table.num_rows;
284 px_ums_tables(px_ums_table_count).delta_num_rows := p_delta_num_rows;
285
286 px_ums_table_count := px_ums_table_count + 1;
287
288 end loop;
289 end loop;
290 exception
291 when others then
292 if (g_debug_flag = DEBUG_STATS) then
293 debug('Unable to get table details for ' || p_table_name || '.');
294 debug('SQLERRM : ' || sqlerrm);
295 end if;
296 end add_table_details;
297
298 --------------------------------------------------------------------------------
299 -- Analyzes UMS table stats
300 --------------------------------------------------------------------------------
301 procedure analyze_ums_tables
302 is
303 l_ums_tables ums_tables;
304 l_ums_table_count binary_integer;
305 l_debug_flag varchar2(10);
306 begin
307 l_debug_flag := g_debug_flag;
308 g_debug_flag := DEBUG_STATS;
309
310 l_ums_table_count := 0;
311
312 add_table_details(l_ums_tables, l_ums_table_count, 'FND_UMS_BUGFIXES', g_rc.bugfixes);
313 add_table_details(l_ums_tables, l_ums_table_count, 'FND_UMS_BUGFIX_RELATIONSHIPS', g_rc.bugfix_relationships);
314 add_table_details(l_ums_tables, l_ums_table_count, 'FND_UMS_FILES', g_rc.files);
315 add_table_details(l_ums_tables, l_ums_table_count, 'FND_UMS_FILE_VERSIONS', g_rc.file_versions);
316 add_table_details(l_ums_tables, l_ums_table_count, 'FND_UMS_BUGFIX_FILE_VERSIONS', g_rc.bugfix_file_versions);
317
318 if (g_debug_flag = DEBUG_STATS) then
319 debug(' ');
320 debug('Gathering Statistics for ' || l_ums_table_count || ' UMS table(s):');
321 debug(rpad('-', 50, '-'));
322 end if;
323
324 for i in 0 .. l_ums_table_count - 1 loop
325 analyze_table(l_ums_tables(i));
326 end loop;
327
328 g_debug_flag := l_debug_flag;
329 exception
330 when others then
331 g_debug_flag := l_debug_flag;
332 null;
333 end analyze_ums_tables;
334
335 ------------------------------------------------------------------------
336 -- Maps download_mode to data_contents.
337 ------------------------------------------------------------------------
338 function get_data_contents(p_download_mode in varchar2,
339 p_last_definition_date in date,
340 p_last_update_date in date)
341 return data_contents
342 is
343 l_data_contents data_contents;
344 begin
345 l_data_contents.download_mode := p_download_mode;
346 l_data_contents.last_definition_date := p_last_definition_date;
347 l_data_contents.last_update_date := p_last_update_date;
348
349 l_data_contents.has_bugfix_replacement := false;
350 l_data_contents.pil_level := PIL_LEVEL_NONE;
351 l_data_contents.has_files := false;
352 l_data_contents.download_code := '';
353
354 if (p_download_mode = DL_MODE_NONE) then
355 l_data_contents.download_code := '';
356
357 elsif (p_download_mode = DL_MODE_FILES_ONLY) then
358 l_data_contents.download_code := 'F';
359
360 l_data_contents.has_files := true;
361
362 elsif (p_download_mode = DL_MODE_REPLACEMENTS_ONLY) then
363 l_data_contents.download_code := 'BR';
364 l_data_contents.has_bugfix_replacement := true;
365
366 elsif (p_download_mode = DL_MODE_REPLACEMENTS_FILES) then
367 l_data_contents.download_code := 'BRF';
368 l_data_contents.has_bugfix_replacement := true;
369
370 l_data_contents.has_files := true;
371
372 elsif (p_download_mode = DL_MODE_PREREQS_ONLY) then
373 l_data_contents.download_code := 'BRP';
374 l_data_contents.has_bugfix_replacement := true;
375
376 l_data_contents.pil_level := PIL_LEVEL_PREREQS_INCLUDES;
377
378 elsif (p_download_mode = DL_MODE_PREREQS_FILES) then
379 l_data_contents.download_code := 'BRPF';
380 l_data_contents.has_bugfix_replacement := true;
381
382 l_data_contents.pil_level := PIL_LEVEL_PREREQS_INCLUDES;
383 l_data_contents.has_files := true;
384
385 elsif (p_download_mode = DL_MODE_LINKS_ONLY) then
386 l_data_contents.download_code := 'BRPL';
387 l_data_contents.has_bugfix_replacement := true;
388
389 l_data_contents.pil_level := PIL_LEVEL_LINKS;
390
391 elsif (p_download_mode = DL_MODE_LINKS_FILES) then
392 l_data_contents.download_code := 'BRPLF';
393 l_data_contents.has_bugfix_replacement := true;
394
395 l_data_contents.pil_level := PIL_LEVEL_LINKS;
396 l_data_contents.has_files := true;
397
398 else
402 end if;
399 raise_application_error(ERROR_UNKNOWN_DOWNLOAD_MODE,
400 'Unknown DOWNLOAD_MODE: ' || p_download_mode);
401
403
404 return l_data_contents;
405 end get_data_contents;
406
407 ------------------------------------------------------------------------
408 -- Drives download_mode from the has_ flags.
409 ------------------------------------------------------------------------
410 procedure derive_download_mode(px_data_contents in out nocopy data_contents)
411 is
412 l_download_mode varchar2(30);
413 l_download_code varchar2(30);
414 begin
415 l_download_mode := DL_MODE_NONE;
416 l_download_code := '';
417
418 if (px_data_contents.has_bugfix_replacement) then
419 l_download_mode := DL_MODE_REPLACEMENTS_ONLY;
420 l_download_code := 'BR';
421
422 if (px_data_contents.pil_level = PIL_LEVEL_PREREQS_INCLUDES) then
423 l_download_mode := DL_MODE_PREREQS_ONLY;
424 l_download_code := 'BRP';
425
426 if (px_data_contents.has_files) then
427 l_download_mode := DL_MODE_PREREQS_FILES;
428 l_download_code := 'BRPF';
429 end if;
430
431 elsif (px_data_contents.pil_level = PIL_LEVEL_LINKS) then
432 l_download_mode := DL_MODE_LINKS_ONLY;
433 l_download_code := 'BRPL';
434
435 if (px_data_contents.has_files) then
436 l_download_mode := DL_MODE_LINKS_FILES;
437 l_download_code := 'BRPLF';
438 end if;
439
440 elsif (px_data_contents.has_files) then
441 l_download_mode := DL_MODE_REPLACEMENTS_FILES;
442 l_download_code := 'BRF';
443 end if;
444
445 elsif (px_data_contents.has_files) then
446 l_download_mode := DL_MODE_FILES_ONLY;
447 l_download_code := 'F';
448 end if;
449
450 px_data_contents.download_mode := l_download_mode;
451 px_data_contents.download_code := l_download_code;
452
453 end derive_download_mode;
454
455 procedure debug_up_fnd_ums_bugfix
456 (p_release_name in varchar2,
457 p_bug_number in varchar2,
458 l_forced in boolean,
459 l_file_dc in data_contents,
460 l_forced_db_dc in data_contents,
461 l_db_dc in data_contents,
462 l_final_dc in data_contents)
463 is
464 l_debug varchar2(32000);
465 begin
466
467 if (g_debug_flag = DEBUG_ON) then
468 l_debug := 'Release Name: ' || p_release_name || ', ' ||
469 'Bug Number: ' || p_bug_number;
470
471 if (l_forced) then
472 l_debug := l_debug || ' CUSTOM_MODE = FORCE';
473 end if;
474
475 debug(l_debug);
476
477 -- Print Download Mode details.
478
479 l_debug := ' ' || rpad('File DM:', 10) ||
480 rpad(l_file_dc.download_mode || '(' || l_file_dc.download_code || ')', 24);
481
482 l_debug := l_debug || ' ' || rpad('DB DM:', 8) ||
483 rpad(l_db_dc.download_mode || '(' || l_db_dc.download_code || ')', 24);
484
485 if (l_forced) then
486 l_debug := l_debug || ' <- ' || rpad('Old DB DM:', 12) ||
487 rpad(l_forced_db_dc.download_mode || '(' || l_forced_db_dc.download_code || ')', 24);
488 end if;
489
490 debug(l_debug);
491
492 -- Print Last Definition Date details.
493
494 l_debug := ' ' || rpad('File LDD:', 10) ||
495 rpad(to_char(l_file_dc.last_definition_date, G_STD_DATE_MASK), 24);
496
497 if (l_file_dc.last_definition_date > l_db_dc.last_definition_date) then
498 l_debug := l_debug || ' > ';
499 elsif (l_file_dc.last_definition_date = l_db_dc.last_definition_date) then
500 l_debug := l_debug || ' = ';
501 else
502 l_debug := l_debug || ' < ';
503 end if;
504
505 l_debug := l_debug || rpad('DB LDD:', 8) ||
506 rpad(to_char(l_db_dc.last_definition_date, G_STD_DATE_MASK), 24);
507
508 if (l_forced) then
509 l_debug := l_debug || ' <- ' || rpad('Old DB LDD:', 12) ||
510 rpad(to_char(l_forced_db_dc.last_definition_date, G_STD_DATE_MASK), 24);
511 end if;
512
513 debug(l_debug);
514
515 -- Print Last Update Date details.
516
517 l_debug := ' ' || rpad('File LUD:', 10) ||
518 rpad(to_char(l_file_dc.last_update_date, G_STD_DATE_MASK), 24);
519
520 if (l_file_dc.last_update_date > l_db_dc.last_update_date) then
521 l_debug := l_debug || ' > ';
522 elsif (l_file_dc.last_update_date = l_db_dc.last_update_date) then
523 l_debug := l_debug || ' = ';
524 else
525 l_debug := l_debug || ' < ';
526 end if;
527
528 l_debug := l_debug || rpad('DB LUD:', 8) ||
529 rpad(to_char(l_db_dc.last_update_date, G_STD_DATE_MASK), 24);
530
531 if (l_forced) then
532 l_debug := l_debug || ' <- ' || rpad('Old DB LUD:', 12) ||
533 rpad(to_char(l_forced_db_dc.last_update_date, G_STD_DATE_MASK), 24);
534 end if;
535
536 debug(l_debug);
537 debug(rpad(' ', 80, '-'));
538
539 -- Print the upload flags.
540
541 if (g_uc.upload_bugfix_replacement) then
542 l_debug := ' up_bugfix_replacement: Y, ';
543 else
544 l_debug := ' up_bugfix_replacement: N, ';
545 end if;
546
547 if (g_uc.upload_prereqs_includes_links) then
548 l_debug := l_debug || 'up_prereqs_includes_links: Y, ';
549 else
550 l_debug := l_debug || 'up_prereqs_includes_links: N, ';
551 end if;
552
553 if (g_uc.upload_files) then
554 l_debug := l_debug || 'up_files: Y';
555 else
559 debug(l_debug);
556 l_debug := l_debug || 'up_files: N';
557 end if;
558
560
561 -- Report final result.
562
563 l_debug := ' ' || rpad('Final DM:', 10) ||
564 rpad(l_final_dc.download_mode || '(' || l_final_dc.download_code || ')', 24);
565
566 debug(l_debug);
567
568 l_debug := ' ' || rpad('Final LDD:',10) ||
569 rpad(to_char(l_final_dc.last_definition_date, G_STD_DATE_MASK), 24);
570
571 debug(l_debug);
572
573 l_debug := ' ' || rpad('Final LUD:',10) ||
574 rpad(to_char(l_final_dc.last_update_date, G_STD_DATE_MASK), 24);
575
576 debug(l_debug);
577
578 debug(' ');
579 end if;
580
581 end debug_up_fnd_ums_bugfix;
582
583 --------------------------------------------------------------------------------
584 procedure up_fnd_ums_bugfix
585 (p_upload_phase in varchar2,
586 p_release_name in varchar2,
587 p_bug_number in varchar2,
588 p_download_mode in varchar2,
589 p_application_short_name in varchar2,
590 p_release_status in varchar2,
591 p_type in varchar2,
592 p_abstract in varchar2,
593 p_last_definition_date in varchar2,
594 p_last_update_date in varchar2,
595 p_custom_mode in varchar2)
596 is
597 l_file_dc data_contents;
598 l_db_dc data_contents;
599 l_final_dc data_contents;
600
601 l_forced boolean;
602 l_forced_db_dc data_contents;
603 begin
604 if (p_upload_phase = 'BEGIN') then
605 -- Lock the entity first
606
607 lock_entity('FND_UMS_BUGFIXES', 'TOP_LEVEL', p_release_name, p_bug_number);
608
609 -- Gather LDT file details
610
611 l_file_dc := get_data_contents(p_download_mode,
612 to_date(nvl(p_last_definition_date, p_last_update_date), G_STD_DATE_MASK),
613 to_date(p_last_update_date, G_STD_DATE_MASK));
614
615 -- Gather database details
616
617 declare
618 l_bugfix fnd_ums_bugfixes%ROWTYPE;
619 begin
620 select /*+ INDEX(fnd_ums_bugfixes fnd_ums_bugfixes_u2) */ *
621 into l_bugfix
622 from fnd_ums_bugfixes
623 where release_name = p_release_name
624 and bug_number = p_bug_number;
625
626 g_bugfix_guid := l_bugfix.bugfix_guid;
627
628 l_db_dc := get_data_contents(l_bugfix.download_mode,
629 l_bugfix.last_definition_date,
630 l_bugfix.last_update_date);
631 exception
632 when no_data_found then
633 -- there is no data for this bugfix in the database
634
635 g_bugfix_guid := sys_guid();
636
637 l_db_dc := get_data_contents(DL_MODE_NONE,
638 g_default_date,
639 g_default_date);
640 end;
641
642 -- determine if any upload is allowed.
643
644 g_uc.upload_bugfix_replacement := false;
645 g_uc.upload_prereqs_includes_links := false;
646 g_uc.upload_files := false;
647
648 l_forced := false;
649 if (p_custom_mode = 'FORCE') then
650 -- If the bugfix is not already FORCEd, then FORCE it to be re-uploaded.
651
652 declare
653 l_already_forced boolean;
654 begin
655 declare
656 l_vc2 varchar2(1);
657 begin
658 -- if a collection doesn't have an entry at a given index then
659 -- fetching the entry from that index raises no_data_found exception.
660
661 l_vc2 := g_forced_bugfixes(p_bug_number);
662 l_already_forced := true;
663 exception
664 when no_data_found then
665 l_already_forced := false;
666 end;
667
668 if (not l_already_forced) then
669 -- Force bugfix to be re-uploaded.
670 l_forced := true;
671
672 l_forced_db_dc := l_db_dc;
673
674 g_uc.upload_bugfix_replacement := true;
675 g_uc.upload_prereqs_includes_links := true;
676 g_uc.upload_files := true;
677
678 l_db_dc := get_data_contents(DL_MODE_NONE,
679 g_default_date,
680 g_default_date);
681
682 -- Mark this bugfix as forced.
683
684 g_forced_bugfixes(p_bug_number) := 'Y';
685 end if;
686 end;
687 end if;
688
689 l_final_dc := l_db_dc;
690
691 -- Decide whether or not bugfix and replacement (BR) should be uploaded
692 --
693 -- | DB
694 -- | no_data_found files_only bugfix_replacement_exists
695 -- ---------+------------------------------------------------------
696 -- files | delete delete do nothing
697 -- F only | insert insert
698 -- i |
699 -- l BR | delete delete file.LUD <= db.LUD : do nothing
700 -- e exists | insert insert file.LUD > db.LUD : delete/insert
701 --
702
703 if (l_file_dc.has_bugfix_replacement) then
704 -- File has bugfix and replacement data
705
706 l_final_dc.has_bugfix_replacement := true;
707
711 if (l_file_dc.last_update_date <= l_db_dc.last_update_date) then
708 if (l_db_dc.has_bugfix_replacement) then
709 -- DB has bugfix and replacement data
710
712 -- File last update date is older or same, do nothing
713
714 null;
715
716 else
717 -- File update date is newer
718
719 l_final_dc.last_update_date := l_file_dc.last_update_date;
720
721 g_uc.upload_bugfix_replacement := true;
722
723 end if; -- LUD
724 else
725 l_final_dc.last_update_date := l_file_dc.last_update_date;
726
727 g_uc.upload_bugfix_replacement := true;
728
729 end if;
730
731 else
732 if (l_db_dc.has_bugfix_replacement) then
733 -- DB has bugfix and replacement data, do nothing
734 null;
735
736 else
737 -- Create the dummy/template bugfix definition for foreign
738 -- key reference purposes.
739
740 g_uc.upload_bugfix_replacement := true;
741
742 l_final_dc.has_bugfix_replacement := false;
743 end if;
744 end if;
745
746 -- Decide whether or not PIL (prereqs/includes/links) data should be uploaded
747
748 if (l_file_dc.pil_level > PIL_LEVEL_NONE) then
749 -- File has PIL data
750
751 if (l_db_dc.pil_level > PIL_LEVEL_NONE) then
752 -- DB has PIL data
753
754 if (l_file_dc.last_definition_date < l_db_dc.last_definition_date) then
755 -- File last definition date is older, do nothing
756 null;
757
758 elsif (l_file_dc.last_definition_date = l_db_dc.last_definition_date) then
759 -- File and DB last definition dates are same, upload the missing
760 -- definition data. Links might be missing.
761 --
762 -- | DB |
763 -- | P L |
764 -- ------+-----+------------------------------
765 -- F P | P L | <- 1st row : Final result
766 -- i | | <- 2nd row : What is uploaded
767 -- l L | L L |
768 -- e | L |
769 --
770 --
771
772 if (l_file_dc.pil_level > l_db_dc.pil_level) then
773 -- Upload the link information
774
775 l_final_dc.last_definition_date := l_file_dc.last_definition_date;
776
777 g_uc.upload_prereqs_includes_links := true;
778
779 l_final_dc.pil_level := l_file_dc.pil_level;
780 end if;
781
782 else
783 -- File definition date is newer
784
785 l_final_dc.last_definition_date := l_file_dc.last_definition_date;
786
787 g_uc.upload_prereqs_includes_links := true;
788
789 l_final_dc.pil_level := l_file_dc.pil_level;
790 end if; -- LDD
791
792 else
793 -- DB has no definition, insert data from file
794
795 l_final_dc.last_definition_date := l_file_dc.last_definition_date;
796
797 g_uc.upload_prereqs_includes_links := true;
798
799 l_final_dc.pil_level := l_file_dc.pil_level;
800 end if; -- l_db_dc.pil_level
801
802 else
803 -- File has no PIL data, do nothing
804 null;
805
806 end if; -- l_file_dc.pil_level
807
808 -- Decide whether or not files should be uploaded
809 --
810 -- | DB
811 -- | no_files files exist
812 -- ---------+--------------------------------
813 -- F no | do nothing do nothing
814 -- i files |
815 -- l |
816 -- e files | delete file.LDD <= db.LDD : do nothing
817 -- exist | insert file.LDD > db.LDD : delete/insert
818 --
819
820 if (l_file_dc.has_files) then
821 -- File has files data
822
823 l_final_dc.has_files := true;
824
825 if (l_db_dc.has_files) then
826 -- DB has files data
827
828 if (l_file_dc.last_definition_date <= l_db_dc.last_definition_date) then
829 -- file.LDD is older than DB.LDD or they are same, do nothing
830
831 null;
832
833 else
834 -- file.LDD is newer than DB.LDD
835 -- Do not change the final.LDD. In ARU LDD reflects changes in dependency
836 -- tree and file contents. New f<bug_number>.ldt file only has file
837 -- contents and the LDD in this file does not reflect the correct LDD
838 -- of the bugfix dependency information.
839
840 g_uc.upload_files := true;
841
842 end if;
843
844 else
845 -- DB has no files data
846
847 g_uc.upload_files := true;
848
849 end if;
850
851 else
852 -- File has no files data, do nothing
853
854 null;
855
856 end if;
857
858 -- Derive Final Download Mode
859
860 derive_download_mode(l_final_dc);
861
862 -- Debug
863
864 if (g_debug_flag = DEBUG_ON) then
865 debug_up_fnd_ums_bugfix(p_release_name,
866 p_bug_number,
867 l_forced,
871 l_final_dc);
868 l_file_dc,
869 l_forced_db_dc,
870 l_db_dc,
872 end if;
873
874 --
875 -- Abort the upload if there is nothing new to upload.
876 -- Disabled until FNDLOAD implements the abort logic.
877 --
878 if (g_debug_flag = DEBUG_ABORT) then
879 if (g_uc.upload_bugfix_replacement or
880 g_uc.upload_prereqs_includes_links or
881 g_uc.upload_files) then
882 null;
883
884 else
885 if ((l_file_dc.last_update_date < l_db_dc.last_update_date) and
886 (l_file_dc.last_definition_date < l_db_dc.last_definition_date)) then
887 -- File is older and has no more data than DB.
888
889 raise_application_error(ERROR_ABORT,
890 MSG_ABORT_OLDER || p_bug_number);
891 else
892 -- Dates are same and file has no more data than DB.
893
894 raise_application_error(ERROR_ABORT,
895 MSG_ABORT_LEVEL || p_bug_number);
896 end if;
897 end if;
898 end if;
899
900 -- Real UPLOAD ...
901
902 -- Delete children ...
903
904 if (g_uc.upload_files) then
905 -- delete files
906
907 delete from fnd_ums_bugfix_file_versions
908 where bugfix_guid = g_bugfix_guid;
909
910 g_rc.bugfix_file_versions := g_rc.bugfix_file_versions + sql%rowcount;
911 end if;
912
913 if (g_uc.upload_prereqs_includes_links) then
914 -- delete prereqs, includes
915
916 delete from fnd_ums_bugfix_relationships
917 where bugfix_guid = g_bugfix_guid
918 and relation_type in (REL_TYPE_PREREQS,
919 REL_TYPE_INDIRECTLY_PREREQS,
920 REL_TYPE_INCLUDES,
921 REL_TYPE_INDIRECTLY_INCLUDES);
922
923 g_rc.bugfix_relationships := g_rc.bugfix_relationships + sql%rowcount;
924 end if;
925
926 -- Insert the bugfix data if necessary
927
928 if (g_uc.upload_bugfix_replacement) then
929 -- delete replacement
930
931 delete from fnd_ums_bugfix_relationships
932 where bugfix_guid = g_bugfix_guid
933 and relation_type = REL_TYPE_REPLACED_BY;
934
935 g_rc.bugfix_relationships := g_rc.bugfix_relationships + sql%rowcount;
936
937 -- delete bugfix
938
939 delete /*+ INDEX(fnd_ums_bugfixes fnd_ums_bugfixes_u1) */
940 from fnd_ums_bugfixes
941 where bugfix_guid = g_bugfix_guid;
942
943 g_rc.bugfixes := g_rc.bugfixes + sql%rowcount;
944
945 -- insert bugfix
946
947 declare
948 l_application_short_name varchar2(32000);
949 l_release_status varchar2(32000);
950 l_type varchar2(32000);
951 l_abstract varchar2(32000);
952 begin
953 if (l_file_dc.download_mode = DL_MODE_FILES_ONLY) then
954 l_application_short_name := nvl(p_application_short_name, NOT_AVAILABLE);
955 l_release_status := nvl(p_release_status, NOT_AVAILABLE);
956 l_type := nvl(p_type, NOT_AVAILABLE);
957 l_abstract := nvl(p_abstract, NOT_AVAILABLE);
958 else
959 l_application_short_name := p_application_short_name;
960 l_release_status := p_release_status;
961 l_type := p_type;
962 l_abstract := p_abstract;
963 end if;
964
965 insert into fnd_ums_bugfixes
966 (bugfix_guid,
967 release_name,
968 bug_number,
969 download_mode,
970 application_short_name,
971 release_status,
972 type,
973 abstract,
974 last_definition_date,
975 last_update_date)
976 values
977 (g_bugfix_guid,
978 p_release_name,
979 p_bug_number,
980 l_final_dc.download_mode,
981 l_application_short_name,
982 l_release_status,
983 l_type,
984 l_abstract,
985 l_final_dc.last_definition_date,
986 l_final_dc.last_update_date);
987
988 g_rc.bugfixes := g_rc.bugfixes + sql%rowcount;
989 end;
990 elsif (g_uc.upload_prereqs_includes_links or g_uc.upload_files) then
991 -- If PIL (affects DM and LDD) or Files (affects DM) are uploaded,
992 -- but bugfix and replacement data is not uploaded
993 -- then download_mode and last_definition_date should be updated.
994 -- For Example: If database is RO, and ldt is LF, and dates are same
995 -- then PIL and Files will be uploaded but bugfix and replacement
996 -- data will not.
997
998 update /*+ INDEX(fnd_ums_bugfixes fnd_ums_bugfixes_u1) */ fnd_ums_bugfixes
999 set download_mode = l_final_dc.download_mode,
1000 last_definition_date = l_final_dc.last_definition_date
1001 where bugfix_guid = g_bugfix_guid;
1002
1003 g_rc.bugfixes := g_rc.bugfixes + sql%rowcount;
1004 end if;
1005
1006 elsif(p_upload_phase = 'END') then
1007 -- no work to do
1008 null;
1009 else
1010 raise_application_error(ERROR_UNKNOWN_UPLOAD_PHASE,
1011 'Unknown UPLOAD_PHASE: ' || p_upload_phase);
1015 end up_fnd_ums_bugfix;
1012 end if;
1013
1014 -- do not catch exceptions here.
1016
1017 --------------------------------------------------------------------------------
1018 function new_file_guid_at
1019 (p_application_short_name in fnd_ums_files.application_short_name%type,
1020 p_location in fnd_ums_files.location%type,
1021 p_name in fnd_ums_files.name%type)
1022 return raw
1023 is
1024 pragma autonomous_transaction;
1025 l_file_guid fnd_ums_files.file_guid%type;
1026 begin
1027 -- lock the entity first
1028
1029 lock_entity('FND_UMS_FILES', p_application_short_name, p_location, p_name);
1030
1031 -- check the existence again
1032
1033 begin
1034 select /*+ INDEX(fnd_ums_files fnd_ums_files_u2) */ file_guid
1035 into l_file_guid
1036 from fnd_ums_files
1037 where application_short_name = p_application_short_name
1038 and location = p_location
1039 and name = p_name;
1040 exception
1041 when no_data_found then
1042 -- populate FND_UMS_FILES
1043
1044 insert into fnd_ums_files
1045 (file_guid,
1046 application_short_name,
1047 location,
1048 name)
1049 values
1050 (sys_guid(),
1051 p_application_short_name,
1052 p_location,
1053 p_name)
1054 returning file_guid
1055 into l_file_guid;
1056
1057 g_rc.files := g_rc.files + sql%rowcount;
1058 end;
1059
1060 commit;
1061
1062 return l_file_guid;
1063
1064 exception
1065 when others then
1066 rollback;
1067 raise;
1068 end new_file_guid_at;
1069
1070 --------------------------------------------------------------------------------
1071 function get_file_guid
1072 (p_application_short_name in fnd_ums_files.application_short_name%type,
1073 p_location in fnd_ums_files.location%type,
1074 p_name in fnd_ums_files.name%type)
1075 return raw
1076 is
1077 l_file_guid fnd_ums_files.file_guid%type;
1078 begin
1079 begin
1080 select /*+ INDEX(fnd_ums_files fnd_ums_files_u2) */ file_guid
1081 into l_file_guid
1082 from fnd_ums_files
1083 where application_short_name = p_application_short_name
1084 and location = p_location
1085 and name = p_name;
1086 exception
1087 when no_data_found then
1088 l_file_guid := new_file_guid_at(p_application_short_name,
1089 p_location,
1090 p_name);
1091 end;
1092
1093 return l_file_guid;
1094 end get_file_guid;
1095
1096 --------------------------------------------------------------------------------
1097 function new_file_version_guid_at
1098 (p_file_guid in fnd_ums_file_versions.file_guid%type,
1099 p_version in fnd_ums_file_versions.version%type)
1100 return raw
1101 is
1102 pragma autonomous_transaction;
1103 l_file_version_guid fnd_ums_file_versions.file_version_guid%type;
1104 begin
1105 -- lock the entity first
1106
1107 lock_entity('FND_UMS_FILE_VERSIONS', p_file_guid, p_version);
1108
1109 -- check the existence again
1110
1111 begin
1112 select /*+ INDEX(fnd_ums_file_versions fnd_ums_file_versions_u2) */ file_version_guid
1113 into l_file_version_guid
1114 from fnd_ums_file_versions
1115 where file_guid = p_file_guid
1116 and version = p_version;
1117 exception
1118 when no_data_found then
1119 -- populate FND_UMS_FILE_VERSIONS
1120
1121 insert into fnd_ums_file_versions
1122 (file_version_guid,
1123 file_guid,
1124 version)
1125 values
1126 (sys_guid(),
1127 p_file_guid,
1128 p_version)
1129 returning file_version_guid
1130 into l_file_version_guid;
1131
1132 g_rc.file_versions := g_rc.file_versions + sql%rowcount;
1133 end;
1134
1135 commit;
1136
1137 return l_file_version_guid;
1138
1139 exception
1140 when others then
1141 rollback;
1142 raise;
1143 end new_file_version_guid_at;
1144
1145 --------------------------------------------------------------------------------
1146 function get_file_version_guid
1147 (p_file_guid in fnd_ums_file_versions.file_guid%type,
1148 p_version in fnd_ums_file_versions.version%type)
1149 return raw
1150 is
1151 l_file_version_guid fnd_ums_file_versions.file_version_guid%type;
1152 begin
1153 begin
1154 select /*+ INDEX(fnd_ums_file_versions fnd_ums_file_versions_u2) */ file_version_guid
1155 into l_file_version_guid
1156 from fnd_ums_file_versions
1157 where file_guid = p_file_guid
1158 and version = p_version;
1159 exception
1160 when no_data_found then
1161 l_file_version_guid := new_file_version_guid_at(p_file_guid,
1162 p_version);
1163 end;
1164
1165 return l_file_version_guid;
1166 end get_file_version_guid;
1167
1168 --------------------------------------------------------------------------------
1169 procedure up_fnd_ums_bugfix_file
1170 (p_application_short_name in varchar2,
1171 p_location in varchar2,
1172 p_name in varchar2,
1173 p_version in varchar2)
1174 is
1175 l_file_guid fnd_ums_file_versions.file_guid%type;
1176 l_file_version_guid fnd_ums_file_versions.file_version_guid%type;
1177 begin
1178 if (g_uc.upload_files) then
1182
1179 -- File upload is allowed.
1180
1181 -- Get file_guid
1183 l_file_guid := get_file_guid(p_application_short_name,
1184 p_location,
1185 p_name);
1186
1187 -- Get file_version_guid
1188
1189 l_file_version_guid := get_file_version_guid(l_file_guid,
1190 p_version);
1191
1192 -- populate FND_UMS_BUGFIX_FILE_VERSIONS
1193
1194 insert into fnd_ums_bugfix_file_versions
1195 (bugfix_guid,
1196 file_version_guid)
1197 values
1198 (g_bugfix_guid,
1199 l_file_version_guid);
1200
1201 g_rc.bugfix_file_versions := g_rc.bugfix_file_versions + sql%rowcount;
1202 else
1203 -- File upload is not allowed.
1204 null;
1205 end if;
1206 end up_fnd_ums_bugfix_file;
1207
1208 --------------------------------------------------------------------------------
1209 function new_bugfix_guid_at
1210 (p_release_name in fnd_ums_bugfixes.release_name%type,
1211 p_bug_number in fnd_ums_bugfixes.bug_number%type)
1212 return raw
1213 is
1214 pragma autonomous_transaction;
1215 l_bugfix_guid fnd_ums_bugfixes.bugfix_guid%type;
1216 begin
1217 -- lock the entity first
1218
1219 lock_entity('FND_UMS_BUGFIXES', p_release_name, p_bug_number);
1220
1221 -- check the existence again
1222
1223 begin
1224 select /*+ INDEX(fnd_ums_bugfixes fnd_ums_bugfixes_u2) */ bugfix_guid
1225 into l_bugfix_guid
1226 from fnd_ums_bugfixes
1227 where release_name = p_release_name
1228 and bug_number = p_bug_number;
1229 exception
1230 when no_data_found then
1231 -- If bugfix doesn't exist then create a DL_MODE_NONE bugfix.
1232 -- This happens in these two cases.
1233 -- - p_download_mode is NONE.
1234 -- This happens when INCLUDES, INDIRECTLY_INCLUDES relationships
1235 -- are downloaded under the top level bugfix.
1236 -- - forward relationship references.
1237 -- If two entities refer to each other, the first entity will
1238 -- have a forward relationship reference to the second one.
1239 -- That second one may not exist in the DB, so a bugfix must
1240 -- be created to get the bugfix_guid. This bugfix is marked
1241 -- as DL_MODE_NONE so that its definition will be replaced
1242 -- with the real definition.
1243
1244 -- populate FND_UMS_BUGFIXES
1245
1246 insert into fnd_ums_bugfixes
1247 (bugfix_guid,
1248 release_name,
1249 bug_number,
1250 download_mode,
1251 application_short_name,
1252 release_status,
1253 type,
1254 abstract,
1255 last_definition_date,
1256 last_update_date)
1257 values
1258 (sys_guid(),
1259 p_release_name,
1260 p_bug_number,
1261 DL_MODE_NONE,
1262 NOT_AVAILABLE,
1263 NOT_AVAILABLE,
1264 NOT_AVAILABLE,
1265 NOT_AVAILABLE,
1266 g_default_date,
1267 g_default_date)
1268 returning bugfix_guid
1269 into l_bugfix_guid;
1270
1271 g_rc.bugfixes := g_rc.bugfixes + sql%rowcount;
1272 end;
1273
1274 commit;
1275
1276 return l_bugfix_guid;
1277
1278 exception
1279 when others then
1280 rollback;
1281 raise;
1282 end new_bugfix_guid_at;
1283
1284 --------------------------------------------------------------------------------
1285 function get_bugfix_guid
1286 (p_release_name in fnd_ums_bugfixes.release_name%type,
1287 p_bug_number in fnd_ums_bugfixes.bug_number%type)
1288 return raw
1289 is
1290 l_bugfix_guid fnd_ums_bugfixes.bugfix_guid%type;
1291 begin
1292 begin
1293 select /*+ INDEX(fnd_ums_bugfixes fnd_ums_bugfixes_u2) */ bugfix_guid
1294 into l_bugfix_guid
1295 from fnd_ums_bugfixes
1296 where release_name = p_release_name
1297 and bug_number = p_bug_number;
1298 exception
1299 when no_data_found then
1300 l_bugfix_guid := new_bugfix_guid_at(p_release_name,
1301 p_bug_number);
1302 end;
1303
1304 return l_bugfix_guid;
1305 end get_bugfix_guid;
1306
1307 --------------------------------------------------------------------------------
1308 procedure up_fnd_ums_bugfix_relationship
1309 (p_relation_type in varchar2,
1310 p_related_bugfix_release_name in varchar2,
1311 p_related_bugfix_bug_number in varchar2,
1312 p_related_bugfix_download_mode in varchar2)
1313 is
1314 l_related_bugfix_guid fnd_ums_bugfix_relationships.related_bugfix_guid%type;
1315 begin
1316 if (((g_uc.upload_prereqs_includes_links) and
1317 (p_relation_type in (REL_TYPE_PREREQS,
1318 REL_TYPE_INDIRECTLY_PREREQS,
1319 REL_TYPE_INCLUDES,
1320 REL_TYPE_INDIRECTLY_INCLUDES))) or
1321 ((g_uc.upload_bugfix_replacement) and
1322 (p_relation_type = REL_TYPE_REPLACED_BY))) then
1323
1324 -- Get the related_bugfix_guid
1325
1326 l_related_bugfix_guid := get_bugfix_guid(p_related_bugfix_release_name,
1327 p_related_bugfix_bug_number);
1328
1329 -- insert the relationship
1330
1331 insert into fnd_ums_bugfix_relationships
1332 (bugfix_guid,
1333 relation_type,
1334 related_bugfix_guid)
1335 values
1339
1336 (g_bugfix_guid,
1337 p_relation_type,
1338 l_related_bugfix_guid);
1340 g_rc.bugfix_relationships := g_rc.bugfix_relationships + sql%rowcount;
1341 else
1342 -- Either relationship upload is not allowed or
1343 -- REL_TYPE_REPLACES, REL_TYPE_REP_BY_FIRST_NON_OBS and unknown
1344 -- relationships are discarded.
1345 null;
1346 end if;
1347 end up_fnd_ums_bugfix_relationship;
1348
1349 --------------------------------------------------------------------------------
1350 procedure up_fnd_ums_one_bugfix
1351 (p_upload_phase in varchar2,
1352 p_release_name in varchar2,
1353 p_bug_number in varchar2)
1354 is
1355 begin
1356 if (p_upload_phase = 'BEGIN') then
1357 analyze_ums_tables();
1358
1359 elsif (p_upload_phase = 'END') then
1360 -- no work to do
1361 null;
1362 else
1363 raise_application_error(ERROR_UNKNOWN_UPLOAD_PHASE,
1364 'Unknown UPLOAD_PHASE: ' || p_upload_phase);
1365 end if;
1366 end up_fnd_ums_one_bugfix;
1367
1368 --------------------------------------------------------------------------------
1369 procedure up_fnd_ums_bugfixes
1370 (p_upload_phase in varchar2,
1371 p_entity_download_mode in varchar2,
1372 p_release_name in varchar2,
1373 p_bug_number in varchar2,
1374 p_start_date in varchar2,
1375 p_end_date in varchar2)
1376 is
1377 begin
1378 if (p_upload_phase = 'BEGIN') then
1379 analyze_ums_tables();
1380
1381 elsif (p_upload_phase = 'END') then
1382 -- no work to do
1383 null;
1384 else
1385 raise_application_error(ERROR_UNKNOWN_UPLOAD_PHASE,
1386 'Unknown UPLOAD_PHASE: ' || p_upload_phase);
1387 end if;
1388 end up_fnd_ums_bugfixes;
1389
1390 --------------------------------------------------------------------------------
1391 function newline
1392 return varchar2
1393 is
1394 l_newline varchar2(100);
1395 l_plsql varchar2(2000);
1396 begin
1397 -- First try fnd_global.newline.
1398 begin
1399 --
1400 -- Use dynamic call not to have compile time dependency
1401 --
1402 l_plsql := 'begin :b_newline := fnd_global.newline(); end;';
1403 execute immediate l_plsql using out l_newline;
1404 exception
1405 when others then
1406 --
1407 -- Use dynamic call to go around the GSCC. chr() is not allowed.
1408 --
1409 l_plsql := 'begin ' ||
1410 ' :b_newline := convert(chr(10), ' ||
1411 ' substr(userenv(''LANGUAGE''), ' ||
1412 ' instr(userenv(''LANGUAGE''), ''.'') + 1), ' ||
1413 ' ''US7ASCII''); ' ||
1414 'end; ';
1415 execute immediate l_plsql using out l_newline;
1416 end;
1417
1418 return l_newline;
1419 end newline;
1420
1421 begin
1422 g_debug_flag := DEBUG_OFF;
1423 g_newline := fnd_ums_loader.newline();
1424
1425 g_default_date := to_date('1900/01/01 00:00:00', G_STD_DATE_MASK);
1426
1427 g_rc.bugfixes := 0;
1428 g_rc.bugfix_relationships := 0;
1429 g_rc.files := 0;
1430 g_rc.file_versions := 0;
1431 g_rc.bugfix_file_versions := 0;
1432
1433 end fnd_ums_loader;