24: -- ------------------------------------------------------------------------
25:
26:
27: --
28: PROCEDURE rule_1_source(r_migration_data IN hr_dm_utility.r_migration_rec,
29: p_valid IN OUT NOCOPY VARCHAR2,
30: p_warning IN OUT NOCOPY VARCHAR2) IS
31: --
32:
34: --
35: BEGIN
36: --
37:
38: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_1_source', 5);
39: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
40: '(p_valid - ' || p_valid ||
41: ')(p_warning - ' || p_warning || ')', 10);
42:
35: BEGIN
36: --
37:
38: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_1_source', 5);
39: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
40: '(p_valid - ' || p_valid ||
41: ')(p_warning - ' || p_warning || ')', 10);
42:
43: -- r_migration_data holds either S or D if in source or destination
43: -- r_migration_data holds either S or D if in source or destination
44: -- otherwise NULL
45: IF (NVL(r_migration_data.database_location,'?') <> 'S') THEN
46: p_valid := 'E';
47: hr_dm_utility.message('INFO','Business rule 1 broken - ' ||
48: r_migration_data.database_location ||
49: ' - No migration can proceed if the current' ||
50: ' database is not the source database.', 15);
51:
51:
52: END IF;
53:
54:
55: hr_dm_utility.message('INFO','Validated rule 1', 215);
56: hr_dm_utility.message('SUMM','Validated rule 1', 220);
57: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_source', 225);
58: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
59: ')(p_warning - ' || p_warning || ')', 230);
52: END IF;
53:
54:
55: hr_dm_utility.message('INFO','Validated rule 1', 215);
56: hr_dm_utility.message('SUMM','Validated rule 1', 220);
57: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_source', 225);
58: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
59: ')(p_warning - ' || p_warning || ')', 230);
60:
53:
54:
55: hr_dm_utility.message('INFO','Validated rule 1', 215);
56: hr_dm_utility.message('SUMM','Validated rule 1', 220);
57: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_source', 225);
58: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
59: ')(p_warning - ' || p_warning || ')', 230);
60:
61:
54:
55: hr_dm_utility.message('INFO','Validated rule 1', 215);
56: hr_dm_utility.message('SUMM','Validated rule 1', 220);
57: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_source', 225);
58: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
59: ')(p_warning - ' || p_warning || ')', 230);
60:
61:
62: -- error handling
61:
62: -- error handling
63: EXCEPTION
64: WHEN OTHERS THEN
65: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_1_source',
66: '(none)','R');
67: RAISE;
68:
69: --
90: -- ------------------------------------------------------------------------
91:
92:
93: --
94: PROCEDURE rule_2_source(r_migration_data IN hr_dm_utility.r_migration_rec,
95: p_valid IN OUT NOCOPY VARCHAR2,
96: p_warning IN OUT NOCOPY VARCHAR2) IS
97: --
98:
106: --
107: BEGIN
108: --
109:
110: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_2_source', 5);
111: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
112: '(p_valid - ' || p_valid ||
113: ')(p_warning - ' || p_warning || ')', 10);
114:
107: BEGIN
108: --
109:
110: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_2_source', 5);
111: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
112: '(p_valid - ' || p_valid ||
113: ')(p_warning - ' || p_warning || ')', 10);
114:
115: -- r_migration_data holds the business_group_ids
118: CLOSE csr_biz_grp;
119: IF (r_migration_data.business_group_id <>
120: NVL(l_business_group_id, -1)) THEN
121: p_valid := 'E';
122: hr_dm_utility.message('INFO','Business rule 2 broken - ' ||
123: r_migration_data.database_location ||
124: ' - For any migration, the business group must' ||
125: ' exist on the source database.', 20);
126: END IF;
124: ' - For any migration, the business group must' ||
125: ' exist on the source database.', 20);
126: END IF;
127:
128: hr_dm_utility.message('INFO','Validated rule 2', 215);
129: hr_dm_utility.message('SUMM','Validated rule 2', 220);
130: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_source', 225);
131: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
132: ')(p_warning - ' || p_warning || ')', 230);
125: ' exist on the source database.', 20);
126: END IF;
127:
128: hr_dm_utility.message('INFO','Validated rule 2', 215);
129: hr_dm_utility.message('SUMM','Validated rule 2', 220);
130: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_source', 225);
131: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
132: ')(p_warning - ' || p_warning || ')', 230);
133:
126: END IF;
127:
128: hr_dm_utility.message('INFO','Validated rule 2', 215);
129: hr_dm_utility.message('SUMM','Validated rule 2', 220);
130: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_source', 225);
131: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
132: ')(p_warning - ' || p_warning || ')', 230);
133:
134:
127:
128: hr_dm_utility.message('INFO','Validated rule 2', 215);
129: hr_dm_utility.message('SUMM','Validated rule 2', 220);
130: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_source', 225);
131: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
132: ')(p_warning - ' || p_warning || ')', 230);
133:
134:
135: -- error handling
134:
135: -- error handling
136: EXCEPTION
137: WHEN OTHERS THEN
138: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_2_source',
139: '(none)','R');
140: RAISE;
141:
142: --
167: -- ------------------------------------------------------------------------
168:
169:
170: --
171: PROCEDURE rule_8_source(r_migration_data IN hr_dm_utility.r_migration_rec,
172: p_valid IN OUT NOCOPY VARCHAR2,
173: p_warning IN OUT NOCOPY VARCHAR2) IS
174: --
175:
183: --
184: BEGIN
185: --
186:
187: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_8_source', 5);
188: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
189: '(p_valid - ' || p_valid ||
190: ')(p_warning - ' || p_warning || ')', 10);
191:
184: BEGIN
185: --
186:
187: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_8_source', 5);
188: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
189: '(p_valid - ' || p_valid ||
190: ')(p_warning - ' || p_warning || ')', 10);
191:
192: OPEN csr_mig_count;
194: CLOSE csr_mig_count;
195:
196: IF (l_mig_count > 1) THEN
197: p_valid := 'E';
198: hr_dm_utility.message('INFO','Business rule 8 broken - ' ||
199: r_migration_data.database_location ||
200: ' - Only one migration can proceed at any one' ||
201: ' time. Only one migration at any one time may' ||
202: ' have a status of S - Started, NS - Not Started' ||
208: ' to enable a new migration to be started.', 40);
209: END IF;
210:
211:
212: hr_dm_utility.message('INFO','Validated rule 8', 215);
213: hr_dm_utility.message('SUMM','Validated rule 8', 220);
214: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_source', 225);
215: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
216: ')(p_warning - ' || p_warning || ')', 230);
209: END IF;
210:
211:
212: hr_dm_utility.message('INFO','Validated rule 8', 215);
213: hr_dm_utility.message('SUMM','Validated rule 8', 220);
214: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_source', 225);
215: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
216: ')(p_warning - ' || p_warning || ')', 230);
217:
210:
211:
212: hr_dm_utility.message('INFO','Validated rule 8', 215);
213: hr_dm_utility.message('SUMM','Validated rule 8', 220);
214: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_source', 225);
215: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
216: ')(p_warning - ' || p_warning || ')', 230);
217:
218:
211:
212: hr_dm_utility.message('INFO','Validated rule 8', 215);
213: hr_dm_utility.message('SUMM','Validated rule 8', 220);
214: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_source', 225);
215: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
216: ')(p_warning - ' || p_warning || ')', 230);
217:
218:
219: -- error handling
218:
219: -- error handling
220: EXCEPTION
221: WHEN OTHERS THEN
222: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_8_source',
223: '(none)','R');
224: RAISE;
225:
226: --
246: -- ------------------------------------------------------------------------
247:
248:
249: --
250: PROCEDURE rule_9_source(r_migration_data IN hr_dm_utility.r_migration_rec,
251: p_valid IN OUT NOCOPY VARCHAR2,
252: p_warning IN OUT NOCOPY VARCHAR2) IS
253: --
254:
262: --
263: BEGIN
264: --
265:
266: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_9_source', 5);
267: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
268: '(p_valid - ' || p_valid ||
269: ')(p_warning - ' || p_warning || ')', 10);
270:
263: BEGIN
264: --
265:
266: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_9_source', 5);
267: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
268: '(p_valid - ' || p_valid ||
269: ')(p_warning - ' || p_warning || ')', 10);
270:
271: OPEN csr_mig_status;
273: CLOSE csr_mig_status;
274:
275: IF (l_status NOT IN ('NS', 'E')) THEN
276: p_valid := 'E';
277: hr_dm_utility.message('INFO','Business rule 9 broken - ' ||
278: r_migration_data.database_location ||
279: ' - A migration can only be rerun if it has a status' ||
280: ' of NS - Not Started or E - Error.', 45);
281: END IF;
280: ' of NS - Not Started or E - Error.', 45);
281: END IF;
282:
283:
284: hr_dm_utility.message('INFO','Validated rule 9', 215);
285: hr_dm_utility.message('SUMM','Validated rule 9', 220);
286: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_source', 225);
287: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
288: ')(p_warning - ' || p_warning || ')', 230);
281: END IF;
282:
283:
284: hr_dm_utility.message('INFO','Validated rule 9', 215);
285: hr_dm_utility.message('SUMM','Validated rule 9', 220);
286: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_source', 225);
287: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
288: ')(p_warning - ' || p_warning || ')', 230);
289:
282:
283:
284: hr_dm_utility.message('INFO','Validated rule 9', 215);
285: hr_dm_utility.message('SUMM','Validated rule 9', 220);
286: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_source', 225);
287: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
288: ')(p_warning - ' || p_warning || ')', 230);
289:
290:
283:
284: hr_dm_utility.message('INFO','Validated rule 9', 215);
285: hr_dm_utility.message('SUMM','Validated rule 9', 220);
286: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_source', 225);
287: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
288: ')(p_warning - ' || p_warning || ')', 230);
289:
290:
291: -- error handling
290:
291: -- error handling
292: EXCEPTION
293: WHEN OTHERS THEN
294: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_9_source',
295: '(none)','R');
296: RAISE;
297:
298: --
320: -- ------------------------------------------------------------------------
321:
322:
323: --
324: PROCEDURE rule_10_source(r_migration_data IN hr_dm_utility.r_migration_rec,
325: p_valid IN OUT NOCOPY VARCHAR2,
326: p_warning IN OUT NOCOPY VARCHAR2) IS
327: --
328:
343: --
344: BEGIN
345: --
346:
347: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_10_source', 5);
348: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
349: '(p_valid - ' || p_valid ||
350: ')(p_warning - ' || p_warning || ')', 10);
351:
344: BEGIN
345: --
346:
347: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_10_source', 5);
348: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
349: '(p_valid - ' || p_valid ||
350: ')(p_warning - ' || p_warning || ')', 10);
351:
352: -- check if a slave has errored
362: -- this includes any of normal (ie finished sucessfully), error, warning,
363: -- cancelled or terminated.
364: IF ( NOT(l_dev_phase = 'COMPLETE')) THEN
365: p_valid := 'E';
366: hr_dm_utility.message('INFO','Business rule 10 broken - ' ||
367: r_migration_data.database_location ||
368: ' - A migration can only be rerun if all the' ||
369: ' slaves and sub-slaves launched by the' ||
370: ' previous run have either completed or' ||
374: END LOOP;
375: CLOSE csr_requests;
376:
377:
378: hr_dm_utility.message('INFO','Validated rule 10', 215);
379: hr_dm_utility.message('SUMM','Validated rule 10', 220);
380: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_10_source', 225);
381: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
382: ')(p_warning - ' || p_warning || ')', 230);
375: CLOSE csr_requests;
376:
377:
378: hr_dm_utility.message('INFO','Validated rule 10', 215);
379: hr_dm_utility.message('SUMM','Validated rule 10', 220);
380: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_10_source', 225);
381: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
382: ')(p_warning - ' || p_warning || ')', 230);
383:
376:
377:
378: hr_dm_utility.message('INFO','Validated rule 10', 215);
379: hr_dm_utility.message('SUMM','Validated rule 10', 220);
380: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_10_source', 225);
381: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
382: ')(p_warning - ' || p_warning || ')', 230);
383:
384:
377:
378: hr_dm_utility.message('INFO','Validated rule 10', 215);
379: hr_dm_utility.message('SUMM','Validated rule 10', 220);
380: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_10_source', 225);
381: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
382: ')(p_warning - ' || p_warning || ')', 230);
383:
384:
385: -- error handling
384:
385: -- error handling
386: EXCEPTION
387: WHEN OTHERS THEN
388: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_10_source',
389: '(none)','R');
390: RAISE;
391:
392: --
415: -- ------------------------------------------------------------------------
416:
417:
418: --
419: PROCEDURE rule_1_dest(r_migration_data IN hr_dm_utility.r_migration_rec,
420: p_valid IN OUT NOCOPY VARCHAR2,
421: p_warning IN OUT NOCOPY VARCHAR2) IS
422: --
423:
425: --
426: BEGIN
427: --
428:
429: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_1_dest', 5);
430: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
431: '(p_valid - ' || p_valid ||
432: ')(p_warning - ' || p_warning || ')', 10);
433:
426: BEGIN
427: --
428:
429: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_1_dest', 5);
430: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
431: '(p_valid - ' || p_valid ||
432: ')(p_warning - ' || p_warning || ')', 10);
433:
434: -- r_migration_data holds either S or D if in dest or destination
434: -- r_migration_data holds either S or D if in dest or destination
435: -- otherwise NULL
436: IF (NVL(r_migration_data.database_location,'?') <> 'D') THEN
437: p_valid := 'E';
438: hr_dm_utility.message('INFO','Business rule 1 broken - ' ||
439: r_migration_data.database_location ||
440: ' - No migration can proceed if the current' ||
441: ' database is not the dest database.', 15);
442:
442:
443: END IF;
444:
445:
446: hr_dm_utility.message('INFO','Validated rule 1', 215);
447: hr_dm_utility.message('SUMM','Validated rule 1', 220);
448: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_dest', 225);
449: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
450: ')(p_warning - ' || p_warning || ')', 230);
443: END IF;
444:
445:
446: hr_dm_utility.message('INFO','Validated rule 1', 215);
447: hr_dm_utility.message('SUMM','Validated rule 1', 220);
448: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_dest', 225);
449: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
450: ')(p_warning - ' || p_warning || ')', 230);
451:
444:
445:
446: hr_dm_utility.message('INFO','Validated rule 1', 215);
447: hr_dm_utility.message('SUMM','Validated rule 1', 220);
448: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_dest', 225);
449: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
450: ')(p_warning - ' || p_warning || ')', 230);
451:
452:
445:
446: hr_dm_utility.message('INFO','Validated rule 1', 215);
447: hr_dm_utility.message('SUMM','Validated rule 1', 220);
448: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_1_dest', 225);
449: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
450: ')(p_warning - ' || p_warning || ')', 230);
451:
452:
453: -- error handling
452:
453: -- error handling
454: EXCEPTION
455: WHEN OTHERS THEN
456: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_1_dest',
457: '(none)','R');
458: RAISE;
459:
460: --
482: -- ------------------------------------------------------------------------
483:
484:
485: --
486: PROCEDURE rule_2_dest(r_migration_data IN hr_dm_utility.r_migration_rec,
487: p_valid IN OUT NOCOPY VARCHAR2,
488: p_warning IN OUT NOCOPY VARCHAR2) IS
489: --
490:
498: --
499: BEGIN
500: --
501:
502: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_2_dest', 5);
503: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
504: '(p_valid - ' || p_valid ||
505: ')(p_warning - ' || p_warning || ')', 10);
506:
499: BEGIN
500: --
501:
502: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_2_dest', 5);
503: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
504: '(p_valid - ' || p_valid ||
505: ')(p_warning - ' || p_warning || ')', 10);
506:
507: IF (r_migration_data.migration_type <> 'FW') THEN
510: CLOSE csr_biz_grp;
511: IF (r_migration_data.business_group_id <>
512: NVL(l_business_group_id, -1)) THEN
513: p_valid := 'E';
514: hr_dm_utility.message('INFO','Business rule 2 broken - ' ||
515: r_migration_data.database_location ||
516: ' - For a non-FW migration the business ' ||
517: 'group must exist in the destination ' ||
518: 'database.', 20);
519: END IF;
520: END IF;
521:
522:
523: hr_dm_utility.message('INFO','Validated rule 2', 215);
524: hr_dm_utility.message('SUMM','Validated rule 2', 220);
525: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_dest', 225);
526: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
527: ')(p_warning - ' || p_warning || ')', 230);
520: END IF;
521:
522:
523: hr_dm_utility.message('INFO','Validated rule 2', 215);
524: hr_dm_utility.message('SUMM','Validated rule 2', 220);
525: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_dest', 225);
526: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
527: ')(p_warning - ' || p_warning || ')', 230);
528:
521:
522:
523: hr_dm_utility.message('INFO','Validated rule 2', 215);
524: hr_dm_utility.message('SUMM','Validated rule 2', 220);
525: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_dest', 225);
526: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
527: ')(p_warning - ' || p_warning || ')', 230);
528:
529:
522:
523: hr_dm_utility.message('INFO','Validated rule 2', 215);
524: hr_dm_utility.message('SUMM','Validated rule 2', 220);
525: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_2_dest', 225);
526: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
527: ')(p_warning - ' || p_warning || ')', 230);
528:
529:
530: -- error handling
529:
530: -- error handling
531: EXCEPTION
532: WHEN OTHERS THEN
533: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_2_dest',
534: '(none)','R');
535: RAISE;
536:
537: --
560: -- ------------------------------------------------------------------------
561:
562:
563: --
564: PROCEDURE rule_6_dest(r_migration_data IN hr_dm_utility.r_migration_rec,
565: p_valid IN OUT NOCOPY VARCHAR2,
566: p_warning IN OUT NOCOPY VARCHAR2) IS
567: --
568:
582: --
583: BEGIN
584: --
585:
586: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_6_dest', 5);
587: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
588: '(p_valid - ' || p_valid ||
589: ')(p_warning - ' || p_warning || ')', 10);
590:
583: BEGIN
584: --
585:
586: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_6_dest', 5);
587: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
588: '(p_valid - ' || p_valid ||
589: ')(p_warning - ' || p_warning || ')', 10);
590:
591: -- get the details of the current migration
606: -- if bg exists and we haven't created it, then raise error
607: IF (l_business_group_id IS NOT NULL)
608: AND (NVL(l_business_group_created,'N') = 'N') THEN
609: p_valid := 'E';
610: hr_dm_utility.message('INFO','Business rule 6 broken - ' ||
611: r_migration_data.database_location ||
612: ' - For a FW migration, the business group' ||
613: ' must not exist on the destination' ||
614: ' database.', 105);
617: -- if bg doesn't exist but we think we have created it then raise error
618: IF (l_business_group_id IS NULL)
619: AND (NVL(l_business_group_created,'N') = 'Y') THEN
620: p_valid := 'E';
621: hr_dm_utility.message('INFO','Business rule 6 broken - ' ||
622: r_migration_data.database_location ||
623: ' - Business Group does not exist ' ||
624: 'although it should have been ' ||
625: 'created already.', 105);
626: END IF;
627:
628: END IF;
629:
630: hr_dm_utility.message('INFO','Validated rule 6', 215);
631: hr_dm_utility.message('SUMM','Validated rule 6', 220);
632: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
633: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
634: ')(p_warning - ' || p_warning || ')', 230);
627:
628: END IF;
629:
630: hr_dm_utility.message('INFO','Validated rule 6', 215);
631: hr_dm_utility.message('SUMM','Validated rule 6', 220);
632: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
633: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
634: ')(p_warning - ' || p_warning || ')', 230);
635:
628: END IF;
629:
630: hr_dm_utility.message('INFO','Validated rule 6', 215);
631: hr_dm_utility.message('SUMM','Validated rule 6', 220);
632: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
633: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
634: ')(p_warning - ' || p_warning || ')', 230);
635:
636:
629:
630: hr_dm_utility.message('INFO','Validated rule 6', 215);
631: hr_dm_utility.message('SUMM','Validated rule 6', 220);
632: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
633: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
634: ')(p_warning - ' || p_warning || ')', 230);
635:
636:
637: -- error handling
636:
637: -- error handling
638: EXCEPTION
639: WHEN OTHERS THEN
640: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_6_dest',
641: '(none)','R');
642: RAISE;
643:
644: --
672: -- ------------------------------------------------------------------------
673:
674:
675: --
676: PROCEDURE rule_7_dest(r_migration_data IN hr_dm_utility.r_migration_rec,
677: p_valid IN OUT NOCOPY VARCHAR2,
678: p_warning IN OUT NOCOPY VARCHAR2) IS
679: --
680:
688: --
689: BEGIN
690: --
691:
692: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_7_dest', 5);
693: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
694: '(p_valid - ' || p_valid ||
695: ')(p_warning - ' || p_warning || ')', 10);
696:
689: BEGIN
690: --
691:
692: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_7_dest', 5);
693: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
694: '(p_valid - ' || p_valid ||
695: ')(p_warning - ' || p_warning || ')', 10);
696:
697: OPEN csr_mig_count;
699: CLOSE csr_mig_count;
700:
701: IF (l_mig_count > 1) THEN
702: p_valid := 'E';
703: hr_dm_utility.message('INFO','Business rule 7 broken - ' ||
704: r_migration_data.database_location ||
705: ' - Only one migration can proceed at any one' ||
706: ' time. Only one migration at any one time may' ||
707: ' have a status of S - Started, NS - Not Started' ||
714: END IF;
715:
716:
717:
718: hr_dm_utility.message('INFO','Validated rule 7', 215);
719: hr_dm_utility.message('SUMM','Validated rule 7', 220);
720: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
721: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
722: ')(p_warning - ' || p_warning || ')', 230);
715:
716:
717:
718: hr_dm_utility.message('INFO','Validated rule 7', 215);
719: hr_dm_utility.message('SUMM','Validated rule 7', 220);
720: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
721: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
722: ')(p_warning - ' || p_warning || ')', 230);
723:
716:
717:
718: hr_dm_utility.message('INFO','Validated rule 7', 215);
719: hr_dm_utility.message('SUMM','Validated rule 7', 220);
720: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
721: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
722: ')(p_warning - ' || p_warning || ')', 230);
723:
724:
717:
718: hr_dm_utility.message('INFO','Validated rule 7', 215);
719: hr_dm_utility.message('SUMM','Validated rule 7', 220);
720: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_7_dest', 225);
721: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
722: ')(p_warning - ' || p_warning || ')', 230);
723:
724:
725: -- error handling
724:
725: -- error handling
726: EXCEPTION
727: WHEN OTHERS THEN
728: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_7_dest',
729: '(none)','R');
730: RAISE;
731:
732: --
759: -- ------------------------------------------------------------------------
760:
761:
762: --
763: PROCEDURE rule_8_dest(r_migration_data IN hr_dm_utility.r_migration_rec,
764: p_valid IN OUT NOCOPY VARCHAR2,
765: p_warning IN OUT NOCOPY VARCHAR2) IS
766: --
767:
775: --
776: BEGIN
777: --
778:
779: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_8_dest', 5);
780: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
781: '(p_valid - ' || p_valid ||
782: ')(p_warning - ' || p_warning || ')', 10);
783:
776: BEGIN
777: --
778:
779: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_8_dest', 5);
780: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
781: '(p_valid - ' || p_valid ||
782: ')(p_warning - ' || p_warning || ')', 10);
783:
784: OPEN csr_mig_status;
786: CLOSE csr_mig_status;
787:
788: IF (l_status NOT IN ('NS', 'E')) THEN
789: p_valid := 'E';
790: hr_dm_utility.message('INFO','Business rule 8 broken - ' ||
791: r_migration_data.database_location ||
792: ' - A migration can only be rerun if it has a status' ||
793: ' of NS - Not Started or E - Error.', 45);
794: END IF;
792: ' - A migration can only be rerun if it has a status' ||
793: ' of NS - Not Started or E - Error.', 45);
794: END IF;
795:
796: hr_dm_utility.message('INFO','Validated rule 8', 215);
797: hr_dm_utility.message('SUMM','Validated rule 8', 220);
798: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_dest', 225);
799: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
800: ')(p_warning - ' || p_warning || ')', 230);
793: ' of NS - Not Started or E - Error.', 45);
794: END IF;
795:
796: hr_dm_utility.message('INFO','Validated rule 8', 215);
797: hr_dm_utility.message('SUMM','Validated rule 8', 220);
798: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_dest', 225);
799: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
800: ')(p_warning - ' || p_warning || ')', 230);
801:
794: END IF;
795:
796: hr_dm_utility.message('INFO','Validated rule 8', 215);
797: hr_dm_utility.message('SUMM','Validated rule 8', 220);
798: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_dest', 225);
799: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
800: ')(p_warning - ' || p_warning || ')', 230);
801:
802:
795:
796: hr_dm_utility.message('INFO','Validated rule 8', 215);
797: hr_dm_utility.message('SUMM','Validated rule 8', 220);
798: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_8_dest', 225);
799: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
800: ')(p_warning - ' || p_warning || ')', 230);
801:
802:
803: -- error handling
802:
803: -- error handling
804: EXCEPTION
805: WHEN OTHERS THEN
806: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_8_dest',
807: '(none)','R');
808: RAISE;
809:
810: --
833: -- ------------------------------------------------------------------------
834:
835:
836: --
837: PROCEDURE rule_9_dest(r_migration_data IN hr_dm_utility.r_migration_rec,
838: p_valid IN OUT NOCOPY VARCHAR2,
839: p_warning IN OUT NOCOPY VARCHAR2) IS
840: --
841:
849: --
850: BEGIN
851: --
852:
853: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_9_dest', 5);
854: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
855: '(p_valid - ' || p_valid ||
856: ')(p_warning - ' || p_warning || ')', 9);
857:
850: BEGIN
851: --
852:
853: hr_dm_utility.message('ROUT','entry:hr_dm_business.rule_9_dest', 5);
854: hr_dm_utility.message('PARA','(r_migration_data - record)' ||
855: '(p_valid - ' || p_valid ||
856: ')(p_warning - ' || p_warning || ')', 9);
857:
858: OPEN csr_mig_status;
860: CLOSE csr_mig_status;
861:
862: IF (l_status NOT IN ('NS', 'E')) THEN
863: p_valid := 'E';
864: hr_dm_utility.message('INFO','Business rule 9 broken - ' ||
865: r_migration_data.database_location ||
866: ' - A migration can only be rerun if it has a status' ||
867: ' of NS - Not Started or E - Error.', 45);
868: END IF;
866: ' - A migration can only be rerun if it has a status' ||
867: ' of NS - Not Started or E - Error.', 45);
868: END IF;
869:
870: hr_dm_utility.message('INFO','Validated rule 9', 215);
871: hr_dm_utility.message('SUMM','Validated rule 9', 220);
872: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_dest', 225);
873: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
874: ')(p_warning - ' || p_warning || ')', 230);
867: ' of NS - Not Started or E - Error.', 45);
868: END IF;
869:
870: hr_dm_utility.message('INFO','Validated rule 9', 215);
871: hr_dm_utility.message('SUMM','Validated rule 9', 220);
872: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_dest', 225);
873: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
874: ')(p_warning - ' || p_warning || ')', 230);
875:
868: END IF;
869:
870: hr_dm_utility.message('INFO','Validated rule 9', 215);
871: hr_dm_utility.message('SUMM','Validated rule 9', 220);
872: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_dest', 225);
873: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
874: ')(p_warning - ' || p_warning || ')', 230);
875:
876:
869:
870: hr_dm_utility.message('INFO','Validated rule 9', 215);
871: hr_dm_utility.message('SUMM','Validated rule 9', 220);
872: hr_dm_utility.message('ROUT','exit:hr_dm_business.rule_9_dest', 225);
873: hr_dm_utility.message('PARA','(p_valid - ' || p_valid ||
874: ')(p_warning - ' || p_warning || ')', 230);
875:
876:
877: -- error handling
876:
877: -- error handling
878: EXCEPTION
879: WHEN OTHERS THEN
880: hr_dm_utility.error(SQLCODE,'hr_dm_business.rule_9_dest',
881: '(none)','R');
882: RAISE;
883:
884: --
920:
921:
922: --
923: FUNCTION last_migration_date(
924: r_migration_data IN hr_dm_utility.r_migration_rec)
925: RETURN DATE IS
926: --
927:
928: l_last_migration_date DATE;
996: --
997: BEGIN
998: --
999:
1000: hr_dm_utility.message('ROUT','entry:hr_dm_business.last_migration_date', 5);
1001: hr_dm_utility.message('PARA','(r_migration_data - record)', 10);
1002:
1003: -- if we are doing an FW / SR migration, then we want to migrate all
1004: -- data, so last migration date is null
997: BEGIN
998: --
999:
1000: hr_dm_utility.message('ROUT','entry:hr_dm_business.last_migration_date', 5);
1001: hr_dm_utility.message('PARA','(r_migration_data - record)', 10);
1002:
1003: -- if we are doing an FW / SR migration, then we want to migrate all
1004: -- data, so last migration date is null
1005:
1002:
1003: -- if we are doing an FW / SR migration, then we want to migrate all
1004: -- data, so last migration date is null
1005:
1006: hr_dm_utility.message('INFO','src - ' ||
1007: r_migration_data.source_database_instance, 10);
1008: hr_dm_utility.message('INFO','dest - ' ||
1009: r_migration_data.destination_database_instance, 10);
1010:
1004: -- data, so last migration date is null
1005:
1006: hr_dm_utility.message('INFO','src - ' ||
1007: r_migration_data.source_database_instance, 10);
1008: hr_dm_utility.message('INFO','dest - ' ||
1009: r_migration_data.destination_database_instance, 10);
1010:
1011: IF r_migration_data.migration_type IN('FW','SR', 'D') THEN
1012: l_last_migration_date := NULL;
1033: l_last_fw_date := l_last_date;
1034: END IF;
1035: CLOSE csr_mig_date;
1036:
1037: hr_dm_utility.message('INFO','l_last_fw_date - ' || l_last_fw_date, 10);
1038: hr_dm_utility.message('INFO','l_last_date - ' || l_last_date, 10);
1039:
1040: -- have we finished a migration for the same business group, source and
1041: -- destination databases for the same migration type since the last
1034: END IF;
1035: CLOSE csr_mig_date;
1036:
1037: hr_dm_utility.message('INFO','l_last_fw_date - ' || l_last_fw_date, 10);
1038: hr_dm_utility.message('INFO','l_last_date - ' || l_last_date, 10);
1039:
1040: -- have we finished a migration for the same business group, source and
1041: -- destination databases for the same migration type since the last
1042: -- finished FW migration?
1048: ELSE
1049: l_last_migration_date := l_last_fw_date;
1050: END IF;
1051:
1052: hr_dm_utility.message('INFO','l_last_migration_date - ' || l_last_migration_date, 10);
1053:
1054: l_migration_type_test := r_migration_data.migration_type;
1055: OPEN csr_mig_date_othr;
1056: FETCH csr_mig_date_othr INTO l_last_date;
1059: l_last_migration_date := l_last_date;
1060: END IF;
1061: CLOSE csr_mig_date_othr;
1062:
1063: hr_dm_utility.message('INFO','l_last_migration_date - ' || l_last_migration_date, 10);
1064:
1065:
1066: END IF;
1067:
1065:
1066: END IF;
1067:
1068:
1069: hr_dm_utility.message('INFO','Found last migration date', 15);
1070: hr_dm_utility.message('SUMM','Found last migration date', 20);
1071: hr_dm_utility.message('ROUT','exit:hr_dm_business.last_migration_date', 25);
1072: hr_dm_utility.message('PARA','(l_last_migration_date - ' ||
1073: l_last_migration_date || ')', 30);
1066: END IF;
1067:
1068:
1069: hr_dm_utility.message('INFO','Found last migration date', 15);
1070: hr_dm_utility.message('SUMM','Found last migration date', 20);
1071: hr_dm_utility.message('ROUT','exit:hr_dm_business.last_migration_date', 25);
1072: hr_dm_utility.message('PARA','(l_last_migration_date - ' ||
1073: l_last_migration_date || ')', 30);
1074:
1067:
1068:
1069: hr_dm_utility.message('INFO','Found last migration date', 15);
1070: hr_dm_utility.message('SUMM','Found last migration date', 20);
1071: hr_dm_utility.message('ROUT','exit:hr_dm_business.last_migration_date', 25);
1072: hr_dm_utility.message('PARA','(l_last_migration_date - ' ||
1073: l_last_migration_date || ')', 30);
1074:
1075:
1068:
1069: hr_dm_utility.message('INFO','Found last migration date', 15);
1070: hr_dm_utility.message('SUMM','Found last migration date', 20);
1071: hr_dm_utility.message('ROUT','exit:hr_dm_business.last_migration_date', 25);
1072: hr_dm_utility.message('PARA','(l_last_migration_date - ' ||
1073: l_last_migration_date || ')', 30);
1074:
1075:
1076:
1078:
1079: -- error handling
1080: EXCEPTION
1081: WHEN OTHERS THEN
1082: hr_dm_utility.error(SQLCODE,'hr_dm_business.last_migration_date','(none)',
1083: 'R');
1084: RAISE;
1085:
1086:
1111:
1112:
1113: --
1114: FUNCTION validate_migration(r_migration_data IN
1115: hr_dm_utility.r_migration_rec)
1116: RETURN VARCHAR2 IS
1117: --
1118:
1119: l_valid VARCHAR2(1);
1130: --
1131: BEGIN
1132: --
1133:
1134: hr_dm_utility.message('ROUT','entry:hr_dm_business.validate_migration', 5);
1135: hr_dm_utility.message('PARA','(r_migration_data - record)', 10);
1136:
1137:
1138: -- assume that migration is valid - then test to see if there are problems
1131: BEGIN
1132: --
1133:
1134: hr_dm_utility.message('ROUT','entry:hr_dm_business.validate_migration', 5);
1135: hr_dm_utility.message('PARA','(r_migration_data - record)', 10);
1136:
1137:
1138: -- assume that migration is valid - then test to see if there are problems
1139: l_valid := 'V';
1176: IF (l_valid = 'Y' AND l_warning = 'V') THEN
1177: l_valid := 'W';
1178: END IF;
1179:
1180: hr_dm_utility.message('INFO','Validated migration', 215);
1181: hr_dm_utility.message('SUMM','Validated migration', 220);
1182: hr_dm_utility.message('ROUT','exit:hr_dm_business.validate_migration', 225);
1183: hr_dm_utility.message('PARA','(l_valid - ' || l_valid || ')', 230);
1184:
1177: l_valid := 'W';
1178: END IF;
1179:
1180: hr_dm_utility.message('INFO','Validated migration', 215);
1181: hr_dm_utility.message('SUMM','Validated migration', 220);
1182: hr_dm_utility.message('ROUT','exit:hr_dm_business.validate_migration', 225);
1183: hr_dm_utility.message('PARA','(l_valid - ' || l_valid || ')', 230);
1184:
1185:
1178: END IF;
1179:
1180: hr_dm_utility.message('INFO','Validated migration', 215);
1181: hr_dm_utility.message('SUMM','Validated migration', 220);
1182: hr_dm_utility.message('ROUT','exit:hr_dm_business.validate_migration', 225);
1183: hr_dm_utility.message('PARA','(l_valid - ' || l_valid || ')', 230);
1184:
1185:
1186: -- overide
1179:
1180: hr_dm_utility.message('INFO','Validated migration', 215);
1181: hr_dm_utility.message('SUMM','Validated migration', 220);
1182: hr_dm_utility.message('ROUT','exit:hr_dm_business.validate_migration', 225);
1183: hr_dm_utility.message('PARA','(l_valid - ' || l_valid || ')', 230);
1184:
1185:
1186: -- overide
1187: -- uncomment to turn off business rule validation for testing purposes
1192:
1193: -- error handling
1194: EXCEPTION
1195: WHEN OTHERS THEN
1196: hr_dm_utility.error(SQLCODE,'hr_dm_business.validate_migration',
1197: '(none)','R');
1198: RAISE;
1199:
1200: --