1: package body AD_APPS_PRIVATE as
2: /* $Header: adaprb.pls 120.5 2007/02/15 14:54:34 stangutu ship $ */
3:
4: --
5: -- PRIVATE GLOBAL VARIABLES
65: exception
66: when others then
67:
68: if abbrev_stmt = 'FALSE' then
69: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
70: ','||ddl_text|| '): '||ad_apps_private.error_buf;
71: else
72: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
73: ', $statement$): '||ad_apps_private.error_buf;
66: when others then
67:
68: if abbrev_stmt = 'FALSE' then
69: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
70: ','||ddl_text|| '): '||ad_apps_private.error_buf;
71: else
72: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
73: ', $statement$): '||ad_apps_private.error_buf;
74: end if;
68: if abbrev_stmt = 'FALSE' then
69: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
70: ','||ddl_text|| '): '||ad_apps_private.error_buf;
71: else
72: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
73: ', $statement$): '||ad_apps_private.error_buf;
74: end if;
75:
76: raise;
69: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
70: ','||ddl_text|| '): '||ad_apps_private.error_buf;
71: else
72: ad_apps_private.error_buf := 'do_apps_ddl('||schema_name||
73: ', $statement$): '||ad_apps_private.error_buf;
74: end if;
75:
76: raise;
77: end do_apps_ddl;
106: using lb, ub, add_newline;
107:
108: exception
109: when others then
110: ad_apps_private.error_buf := 'do_apps_array_ddl('||schema_name||', '||
111: lb||', '||ub||', '||add_newline||'): '||
112: ad_apps_private.error_buf;
113: raise;
114: end do_apps_array_ddl;
108: exception
109: when others then
110: ad_apps_private.error_buf := 'do_apps_array_ddl('||schema_name||', '||
111: lb||', '||ub||', '||add_newline||'): '||
112: ad_apps_private.error_buf;
113: raise;
114: end do_apps_array_ddl;
115:
116: procedure do_apps_array_ddl
142: using rowcount, ddl_text;
143:
144: exception
145: when others then
146: ad_apps_private.error_buf := 'do_array_assignment('||schema_name||','||
147: ddl_text||','||rowcount||'): '||ad_apps_private.error_buf;
148: raise;
149: end do_array_assignment;
150:
143:
144: exception
145: when others then
146: ad_apps_private.error_buf := 'do_array_assignment('||schema_name||','||
147: ddl_text||','||rowcount||'): '||ad_apps_private.error_buf;
148: raise;
149: end do_array_assignment;
150:
151:
200: end if;
201: end if;
202: exception
203: when others then
204: ad_apps_private.error_buf := 'check_for_apps_ddl('||schema_name||
205: '): '||ad_apps_private.error_buf;
206: raise;
207: end check_for_apps_ddl;
208:
201: end if;
202: exception
203: when others then
204: ad_apps_private.error_buf := 'check_for_apps_ddl('||schema_name||
205: '): '||ad_apps_private.error_buf;
206: raise;
207: end check_for_apps_ddl;
208:
209: --
223: -- no rows returned then return false
224: return FALSE;
225: exception
226: when others then
227: ad_apps_private.error_buf := 'check_if_schema_exists('||schema_name||
228: '): '||ad_apps_private.error_buf;
229: raise;
230: end check_if_schema_exists;
231:
224: return FALSE;
225: exception
226: when others then
227: ad_apps_private.error_buf := 'check_if_schema_exists('||schema_name||
228: '): '||ad_apps_private.error_buf;
229: raise;
230: end check_if_schema_exists;
231:
232: --
259: p_object_name || '" TO ' || p_grantee_schema_name);
260: IF (p_with_grant_option) THEN
261: l_statement := l_statement || ' WITH GRANT OPTION';
262: END IF;
263: ad_apps_private.do_apps_ddl(p_grantor_schema_name, l_statement);
264: EXCEPTION
265: WHEN no_privileges_to_grant THEN
266: --
267: -- In case of APPS1 to APPS2 granting this can happen
277: WHERE owner = p_grantor_schema_name
278: AND object_name = p_object_name;
279: EXCEPTION
280: WHEN OTHERS THEN
281: ad_apps_private.error_buf :=
282: p_object_name || ' does not exist in ' ||
283: p_grantor_schema_name || ad_apps_private.error_buf;
284: RAISE;
285: END;
279: EXCEPTION
280: WHEN OTHERS THEN
281: ad_apps_private.error_buf :=
282: p_object_name || ' does not exist in ' ||
283: p_grantor_schema_name || ad_apps_private.error_buf;
284: RAISE;
285: END;
286: IF (l_object_type = 'SYNONYM') THEN
287: BEGIN
291: WHERE owner = p_grantor_schema_name
292: AND synonym_name = p_object_name;
293: EXCEPTION
294: WHEN OTHERS THEN
295: ad_apps_private.error_buf :=
296: 'Synonym ' || p_object_name || ' does not exist in ' ||
297: p_grantor_schema_name || ad_apps_private.error_buf;
298: RAISE;
299: END;
293: EXCEPTION
294: WHEN OTHERS THEN
295: ad_apps_private.error_buf :=
296: 'Synonym ' || p_object_name || ' does not exist in ' ||
297: p_grantor_schema_name || ad_apps_private.error_buf;
298: RAISE;
299: END;
300: --
301: -- Check to recursion depth in case of circular synonyms.
302: --
303: l_recursion_depth := Nvl(p_recursion_depth, 0) + 1;
304: IF (l_recursion_depth < 0 OR
305: l_recursion_depth > 20) THEN
306: ad_apps_private.error_buf :=
307: 'Recursion depth exceeded the limit (0-20) : ' ||
308: l_recursion_depth || ad_apps_private.error_buf;
309: RAISE;
310: END IF;
304: IF (l_recursion_depth < 0 OR
305: l_recursion_depth > 20) THEN
306: ad_apps_private.error_buf :=
307: 'Recursion depth exceeded the limit (0-20) : ' ||
308: l_recursion_depth || ad_apps_private.error_buf;
309: RAISE;
310: END IF;
311: --
312: -- Recursively call to get grantable grant.
319: p_recursion_depth => l_recursion_depth);
320: --
321: -- Now we have the grant from previous owner schema.
322: --
323: ad_apps_private.do_apps_ddl(p_grantor_schema_name, l_statement);
324: ELSE
325: ad_apps_private.error_buf :=
326: 'No priv to grant for a non-synonym object. ' ||
327: ad_apps_private.error_buf;
321: -- Now we have the grant from previous owner schema.
322: --
323: ad_apps_private.do_apps_ddl(p_grantor_schema_name, l_statement);
324: ELSE
325: ad_apps_private.error_buf :=
326: 'No priv to grant for a non-synonym object. ' ||
327: ad_apps_private.error_buf;
328: RAISE;
329: END IF;
323: ad_apps_private.do_apps_ddl(p_grantor_schema_name, l_statement);
324: ELSE
325: ad_apps_private.error_buf :=
326: 'No priv to grant for a non-synonym object. ' ||
327: ad_apps_private.error_buf;
328: RAISE;
329: END IF;
330: END;
331:
340: FROM dba_queues where name = p_object_name;
341:
342: EXCEPTION
343: WHEN OTHERS THEN
344: ad_apps_private.error_buf := 'create_grant('||
345: p_object_name || ' does not exist in ' ||
346: l_queue_owner ||'): ' || ad_apps_private.error_buf;
347: RAISE;
348: END;
342: EXCEPTION
343: WHEN OTHERS THEN
344: ad_apps_private.error_buf := 'create_grant('||
345: p_object_name || ' does not exist in ' ||
346: l_queue_owner ||'): ' || ad_apps_private.error_buf;
347: RAISE;
348: END;
349:
350: IF l_exists = 1 THEN
353: grantee =>p_grantee_schema_name,grant_option=>TRUE);
354: END IF;
355:
356: WHEN no_privileges_to_grant THEN
357: ad_apps_private.error_buf := null;
358:
359: WHEN OTHERS THEN
360: DECLARE
361: l_with_grant_option_text VARCHAR2(10) := 'FALSE';
362: BEGIN
363: IF (p_with_grant_option) THEN
364: l_with_grant_option_text := 'TRUE';
365: END IF;
366: ad_apps_private.error_buf := 'create_grant('||
367: p_grantor_schema_name || ',' || p_grantee_schema_name || ',' ||
368: p_object_name || ',' || p_privileges || ',' ||
369: l_with_grant_option_text || ',' || p_recursion_depth || '): ' ||
370: ad_apps_private.error_buf;
366: ad_apps_private.error_buf := 'create_grant('||
367: p_grantor_schema_name || ',' || p_grantee_schema_name || ',' ||
368: p_object_name || ',' || p_privileges || ',' ||
369: l_with_grant_option_text || ',' || p_recursion_depth || '): ' ||
370: ad_apps_private.error_buf;
371: END;
372: RAISE;
373: END create_grant;
374:
386: BEGIN
387: l_statement := ('CREATE SYNONYM "' || p_to_object_name || '" FOR ' ||
388: p_from_schema_name || '."' ||
389: p_from_object_name || '"');
390: ad_apps_private.do_apps_ddl(p_to_schema_name, l_statement);
391: EXCEPTION
392: WHEN name_is_already_used THEN
393: BEGIN
394: SELECT object_type
397: WHERE owner = p_to_schema_name
398: AND object_name = p_to_object_name;
399: EXCEPTION
400: WHEN OTHERS THEN
401: ad_apps_private.error_buf :=
402: p_to_object_name || ' does not exist in ' ||
403: p_to_schema_name || ad_apps_private.error_buf;
404: RAISE;
405: END;
399: EXCEPTION
400: WHEN OTHERS THEN
401: ad_apps_private.error_buf :=
402: p_to_object_name || ' does not exist in ' ||
403: p_to_schema_name || ad_apps_private.error_buf;
404: RAISE;
405: END;
406: IF (l_object_type = 'SYNONYM') THEN
407: --
406: IF (l_object_type = 'SYNONYM') THEN
407: --
408: -- Drop the synonym and then re-create.
409: --
410: ad_apps_private.drop_object(p_to_schema_name, p_to_object_name,
411: 'SYNONYM');
412: ad_apps_private.do_apps_ddl(p_to_schema_name, l_statement);
413: ELSE
414: RAISE;
408: -- Drop the synonym and then re-create.
409: --
410: ad_apps_private.drop_object(p_to_schema_name, p_to_object_name,
411: 'SYNONYM');
412: ad_apps_private.do_apps_ddl(p_to_schema_name, l_statement);
413: ELSE
414: RAISE;
415: END IF;
416: END;
415: END IF;
416: END;
417: EXCEPTION
418: WHEN OTHERS THEN
419: ad_apps_private.error_buf := 'create_synonym('||
420: p_from_schema_name || ',' || p_from_object_name || ',' ||
421: p_to_schema_name || ',' || p_to_object_name || '): ' ||
422: ad_apps_private.error_buf;
423: RAISE;
418: WHEN OTHERS THEN
419: ad_apps_private.error_buf := 'create_synonym('||
420: p_from_schema_name || ',' || p_from_object_name || ',' ||
421: p_to_schema_name || ',' || p_to_object_name || '): ' ||
422: ad_apps_private.error_buf;
423: RAISE;
424: END create_synonym;
425:
426: procedure create_grants_and_synonyms
432: is
433: begin
434: -- initialize variables; call init functions
435:
436: ad_apps_private.error_buf := null;
437:
438: ad_apps_private.initialize(aol_schema);
439:
440: ad_apps_private.load_exception_list;
434: -- initialize variables; call init functions
435:
436: ad_apps_private.error_buf := null;
437:
438: ad_apps_private.initialize(aol_schema);
439:
440: ad_apps_private.load_exception_list;
441:
442: -- first make sure that the apps_ddl packages exist
436: ad_apps_private.error_buf := null;
437:
438: ad_apps_private.initialize(aol_schema);
439:
440: ad_apps_private.load_exception_list;
441:
442: -- first make sure that the apps_ddl packages exist
443: -- in all relevent schemas
444:
441:
442: -- first make sure that the apps_ddl packages exist
443: -- in all relevent schemas
444:
445: ad_apps_private.check_for_apps_ddl(from_schema);
446: ad_apps_private.check_for_apps_ddl(apps_schema);
447:
448: -- create grants and synonyms from base to apps
449: --
442: -- first make sure that the apps_ddl packages exist
443: -- in all relevent schemas
444:
445: ad_apps_private.check_for_apps_ddl(from_schema);
446: ad_apps_private.check_for_apps_ddl(apps_schema);
447:
448: -- create grants and synonyms from base to apps
449: --
450: -- if force=TRUE, will drop all synonyms in apps schema corresponding
460: create_base_gs(from_schema, apps_schema, force);
461:
462: exception
463: when others then
464: ad_apps_private.error_buf := 'create_grants_and_synonyms('||
465: install_group_num||','||from_schema||','||aol_schema||','||
466: apps_schema||'): '||ad_apps_private.error_buf;
467: raise;
468:
462: exception
463: when others then
464: ad_apps_private.error_buf := 'create_grants_and_synonyms('||
465: install_group_num||','||from_schema||','||aol_schema||','||
466: apps_schema||'): '||ad_apps_private.error_buf;
467: raise;
468:
469: end create_grants_and_synonyms;
470:
529: g_Un_Cache_Tbl(ign||'_aol') := l_apps_schema;
530: EXCEPTION
531: when others then
532: dbms_sql.close_cursor(c);
533: ad_apps_private.error_buf := 'c_statement='||c_statement||': '||
534: ad_apps_private.error_buf;
535: raise;
536: END ; -- Block 1
537: END IF ; -- Cache check
530: EXCEPTION
531: when others then
532: dbms_sql.close_cursor(c);
533: ad_apps_private.error_buf := 'c_statement='||c_statement||': '||
534: ad_apps_private.error_buf;
535: raise;
536: END ; -- Block 1
537: END IF ; -- Cache check
538:
538:
539:
540: -- from the IGN get the MLS_APPS schema if it exists, otherwise default it
541: -- Only do this if MLS is enabled.
542: if ad_apps_private.is_mls is null then
543: ad_apps_private.initialize(aol_or_apps_schema);
544: end if;
545:
546: if is_mls then
539:
540: -- from the IGN get the MLS_APPS schema if it exists, otherwise default it
541: -- Only do this if MLS is enabled.
542: if ad_apps_private.is_mls is null then
543: ad_apps_private.initialize(aol_or_apps_schema);
544: end if;
545:
546: if is_mls then
547: IF ( g_Un_Cache_Tbl.COUNT <> 0 AND g_Un_Cache_Tbl.EXISTS (ign||'_mls') ) THEN
571: g_Un_Cache_Tbl(ign||'_mls') := l_mls_apps_schema ;
572: EXCEPTION
573: when others then
574: dbms_sql.close_cursor(c);
575: ad_apps_private.error_buf := 'c_statement='||c_statement||': '||
576: ad_apps_private.error_buf;
577: raise;
578: END ; -- Block 2
579: END IF ; -- if cache check 2
572: EXCEPTION
573: when others then
574: dbms_sql.close_cursor(c);
575: ad_apps_private.error_buf := 'c_statement='||c_statement||': '||
576: ad_apps_private.error_buf;
577: raise;
578: END ; -- Block 2
579: END IF ; -- if cache check 2
580: END IF ;
583: apps_mls_schema := l_mls_apps_schema;
584:
585: exception
586: when others then
587: ad_apps_private.error_buf := 'get_apps_schema_name('||ign||
588: ','||aol_or_apps_schema||'): '||ad_apps_private.error_buf;
589: raise;
590: END get_apps_schema_name;
591:
584:
585: exception
586: when others then
587: ad_apps_private.error_buf := 'get_apps_schema_name('||ign||
588: ','||aol_or_apps_schema||'): '||ad_apps_private.error_buf;
589: raise;
590: END get_apps_schema_name;
591:
592: procedure drop_object
624: upper(object_type) = 'PACKAGE' or
625: upper(object_type) = 'PACKAGE BODY' then
626: null;
627: else
628: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
629: object_name||
630: ','||object_type||'): '||ad_apps_private.error_buf;
631: raise;
632: end if;
626: null;
627: else
628: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
629: object_name||
630: ','||object_type||'): '||ad_apps_private.error_buf;
631: raise;
632: end if;
633: -- trap ora -942 (Table or view xxx does not exist)
634: when table_view_not_exist then
635: dbms_sql.close_cursor(c);
636: if upper(object_type) = 'VIEW' then
637: null;
638: else
639: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
640: object_name||
641: ','||object_type||'): '||ad_apps_private.error_buf;
642: raise;
643: end if;
637: null;
638: else
639: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
640: object_name||
641: ','||object_type||'): '||ad_apps_private.error_buf;
642: raise;
643: end if;
644: -- trap ora -4080 (Trigger does not exist)
645: when trigger_not_exist then
646: dbms_sql.close_cursor(c);
647: if upper(object_type) = 'TRIGGER' then
648: null;
649: else
650: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
651: object_name||
652: ','||object_type||'): '||ad_apps_private.error_buf;
653: raise;
654: end if;
648: null;
649: else
650: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
651: object_name||
652: ','||object_type||'): '||ad_apps_private.error_buf;
653: raise;
654: end if;
655: -- trap ora -1434 (Synonym does not exist)
656: when synonym_not_exist then
657: dbms_sql.close_cursor(c);
658: if upper(object_type) = 'SYNONYM' then
659: null;
660: else
661: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
662: object_name||','||object_type||'): '||
663: ad_apps_private.error_buf;
664: raise;
665: end if;
659: null;
660: else
661: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
662: object_name||','||object_type||'): '||
663: ad_apps_private.error_buf;
664: raise;
665: end if;
666: -- trap ora -2289 (Sequence does not exist)
667: when sequence_not_exist then
668: dbms_sql.close_cursor(c);
669: if upper(object_type) = 'SEQUENCE' then
670: null;
671: else
672: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
673: object_name||','||object_type||'): '||
674: ad_apps_private.error_buf;
675: raise;
676: end if;
670: null;
671: else
672: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
673: object_name||','||object_type||'): '||
674: ad_apps_private.error_buf;
675: raise;
676: end if;
677: when others then
678: dbms_sql.close_cursor(c);
675: raise;
676: end if;
677: when others then
678: dbms_sql.close_cursor(c);
679: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
680: object_name||
681: ','||object_type||'): '||ad_apps_private.error_buf;
682: raise;
683: end drop_object;
677: when others then
678: dbms_sql.close_cursor(c);
679: ad_apps_private.error_buf := 'drop_object('||target_schema||','||
680: object_name||
681: ','||object_type||'): '||ad_apps_private.error_buf;
682: raise;
683: end drop_object;
684:
685:
698: -- the exception. Only try to remedy the exception once, then call
699: -- copy_view_internal again. If the second call fails, just fail.
700: --
701: begin
702: ad_apps_private.copy_view_internal(view_name, from_schema, to_schema);
703: exception
704: when others then
705: --
706: --
720:
721: -- try to recompile dependent objects
722: -- Put the "Stack Trace" info in the extra_buf string
723:
724: extra_buf := ' +++(ad_apps_private.recomp_referenced_objs('||view_name||
725: ',VIEW,'||from_schema||','||to_schema||'))+++ ';
726:
727: begin
728: ad_apps_private.recomp_referenced_objs(view_name, 'VIEW',
724: extra_buf := ' +++(ad_apps_private.recomp_referenced_objs('||view_name||
725: ',VIEW,'||from_schema||','||to_schema||'))+++ ';
726:
727: begin
728: ad_apps_private.recomp_referenced_objs(view_name, 'VIEW',
729: from_schema, to_schema);
730:
731: extra_buf := '+++(ad_apps_private.copy_view_internal('||
732: view_name||','||from_schema||','||to_schema||')+++';
727: begin
728: ad_apps_private.recomp_referenced_objs(view_name, 'VIEW',
729: from_schema, to_schema);
730:
731: extra_buf := '+++(ad_apps_private.copy_view_internal('||
732: view_name||','||from_schema||','||to_schema||')+++';
733:
734: -- try creating the view again
735: ad_apps_private.copy_view_internal(view_name, from_schema, to_schema);
731: extra_buf := '+++(ad_apps_private.copy_view_internal('||
732: view_name||','||from_schema||','||to_schema||')+++';
733:
734: -- try creating the view again
735: ad_apps_private.copy_view_internal(view_name, from_schema, to_schema);
736:
737: exception
738: when others then
739: -- Ignore any compilation errors. If a dependent view is invalid,
748:
749: end; -- end of first attempt at copying views.
750: exception
751: when others then
752: ad_apps_private.error_buf := 'ad_apps_private.copy_view('||view_name||','
753: ||from_schema||','||to_schema||'): '|| extra_buf ||
754: ad_apps_private.error_buf;
755: raise;
756: end copy_view;
750: exception
751: when others then
752: ad_apps_private.error_buf := 'ad_apps_private.copy_view('||view_name||','
753: ||from_schema||','||to_schema||'): '|| extra_buf ||
754: ad_apps_private.error_buf;
755: raise;
756: end copy_view;
757:
758:
786: if view_text is null then
787: raise numeric_or_value_error;
788: end if;
789:
790: ad_apps_private.build_view_columns(copy_view_internal.from_schema,
791: copy_view_internal.view_name, view_columns);
792:
793: temp_len := length(view_columns) + length(view_text)
794: + length(copy_view_internal.view_name) + 36;
810: name_already_used exception;
811: pragma exception_init(name_already_used, -955);
812: begin
813:
814: ad_apps_private.do_apps_ddl(copy_view_internal.to_schema,statement);
815:
816: exception
817: when invalid_num_columns then
818: -- trap the error ora-1730 invalid number of columns
829: -- Oracle7 will convert the select * into the column list.
830: null;
831: when name_already_used then
832: -- first reset error buf
833: ad_apps_private.error_buf := null;
834: -- drop any synonym that may exist by the same name
835: ad_apps_private.drop_object(copy_view_internal.to_schema,
836: view_name, 'SYNONYM');
837: ad_apps_private.do_apps_ddl(copy_view_internal.to_schema,statement);
831: when name_already_used then
832: -- first reset error buf
833: ad_apps_private.error_buf := null;
834: -- drop any synonym that may exist by the same name
835: ad_apps_private.drop_object(copy_view_internal.to_schema,
836: view_name, 'SYNONYM');
837: ad_apps_private.do_apps_ddl(copy_view_internal.to_schema,statement);
838: when others then
839: raise;
833: ad_apps_private.error_buf := null;
834: -- drop any synonym that may exist by the same name
835: ad_apps_private.drop_object(copy_view_internal.to_schema,
836: view_name, 'SYNONYM');
837: ad_apps_private.do_apps_ddl(copy_view_internal.to_schema,statement);
838: when others then
839: raise;
840: end;
841: --
844: exception
845: when numeric_or_value_error then
846: if temp_len > 30000 then
847: -- reset main error buffer
848: ad_apps_private.error_buf := null;
849:
850: -- Call copy_huge_view
851:
852: ad_apps_private.copy_huge_view(copy_view_internal.view_name,
848: ad_apps_private.error_buf := null;
849:
850: -- Call copy_huge_view
851:
852: ad_apps_private.copy_huge_view(copy_view_internal.view_name,
853: copy_view_internal.from_schema, copy_view_internal.to_schema);
854: else
855: --
856: -- handle case where view text > 32 K
867: if view_size < 24000 then
868: raise;
869: else
870: -- reset main error buffer
871: ad_apps_private.error_buf := null;
872:
873: -- Call copy_huge_view
874:
875: ad_apps_private.copy_huge_view(copy_view_internal.view_name,
871: ad_apps_private.error_buf := null;
872:
873: -- Call copy_huge_view
874:
875: ad_apps_private.copy_huge_view(copy_view_internal.view_name,
876: copy_view_internal.from_schema, copy_view_internal.to_schema);
877:
878: end if;
879: end if;
889: -- Trap and ignore ORA-24344: success with compilation error
890: -- This only happens on ORACLE 8
891: --
892: -- reset main error buffer
893: ad_apps_private.error_buf := null;
894: when others then
895: ad_apps_private.error_buf := 'ad_apps_private.copy_view_internal('||
896: view_name||','||from_schema||','||to_schema||'): '||
897: ad_apps_private.error_buf;
891: --
892: -- reset main error buffer
893: ad_apps_private.error_buf := null;
894: when others then
895: ad_apps_private.error_buf := 'ad_apps_private.copy_view_internal('||
896: view_name||','||from_schema||','||to_schema||'): '||
897: ad_apps_private.error_buf;
898: raise;
899:
893: ad_apps_private.error_buf := null;
894: when others then
895: ad_apps_private.error_buf := 'ad_apps_private.copy_view_internal('||
896: view_name||','||from_schema||','||to_schema||'): '||
897: ad_apps_private.error_buf;
898: raise;
899:
900: end copy_view_internal;
901:
938:
939: statement := 'create or replace force view "'||
940: copy_huge_view.view_name||'" ';
941:
942: ad_apps_private.do_array_assignment(copy_huge_view.toschema,
943: statement, row_count);
944:
945: --
946: -- Add in view columns
945: --
946: -- Add in view columns
947: --
948:
949: ad_apps_private.build_view_columns(copy_huge_view.fromschema,
950: copy_huge_view.view_name, view_columns);
951:
952: -- for substr, position 1 is first character
953:
959: val_length := length(curr_value);
960:
961: row_count := row_count + 1;
962:
963: ad_apps_private.do_array_assignment(copy_huge_view.toschema,
964: curr_value, row_count);
965:
966: position := position + val_length;
967: end loop;
972:
973: statement := ' as ';
974: row_count := row_count + 1;
975:
976: ad_apps_private.do_array_assignment(copy_huge_view.toschema,
977: statement, row_count);
978:
979: --
980: -- Add in view select text
1002: curr_value,val_length);
1003:
1004: row_count := row_count + 1;
1005:
1006: ad_apps_private.do_array_assignment(copy_huge_view.toschema,
1007: curr_value, row_count);
1008:
1009: position := position + val_length;
1010: end loop;
1009: position := position + val_length;
1010: end loop;
1011: else
1012: sys.dbms_sys_sql.close_cursor(c);
1013: ad_apps_private.error_buf := 'statement='||statement||
1014: ':'||ad_apps_private.error_buf;
1015: raise no_data_found;
1016: end if;
1017:
1010: end loop;
1011: else
1012: sys.dbms_sys_sql.close_cursor(c);
1013: ad_apps_private.error_buf := 'statement='||statement||
1014: ':'||ad_apps_private.error_buf;
1015: raise no_data_found;
1016: end if;
1017:
1018: sys.dbms_sys_sql.close_cursor(c);
1027: name_already_used exception;
1028: pragma exception_init(name_already_used, -955);
1029: begin
1030: -- execute the array of statement.
1031: ad_apps_private.do_apps_array_ddl(copy_huge_view.toschema, 1, row_count);
1032: exception
1033: when invalid_num_columns then
1034: -- trap the error ora-1730 invalid number of columns
1035: -- this happens when trying to copy an invalid view that
1045: -- Oracle7 will convert the select * into the column list.
1046: null;
1047: when name_already_used then
1048: -- first reset error buf
1049: ad_apps_private.error_buf := null;
1050: -- drop any synonym that may exist by the same name
1051: ad_apps_private.drop_object(copy_huge_view.toschema,
1052: view_name, 'SYNONYM');
1053: ad_apps_private.do_apps_array_ddl(copy_huge_view.toschema, 1, row_count);
1047: when name_already_used then
1048: -- first reset error buf
1049: ad_apps_private.error_buf := null;
1050: -- drop any synonym that may exist by the same name
1051: ad_apps_private.drop_object(copy_huge_view.toschema,
1052: view_name, 'SYNONYM');
1053: ad_apps_private.do_apps_array_ddl(copy_huge_view.toschema, 1, row_count);
1054: when others then
1055: raise;
1049: ad_apps_private.error_buf := null;
1050: -- drop any synonym that may exist by the same name
1051: ad_apps_private.drop_object(copy_huge_view.toschema,
1052: view_name, 'SYNONYM');
1053: ad_apps_private.do_apps_array_ddl(copy_huge_view.toschema, 1, row_count);
1054: when others then
1055: raise;
1056: end;
1057:
1061: -- Trap and ignore ORA-24344: success with compilation error
1062: -- This only happens on ORACLE 8
1063: --
1064: -- reset main error buffer
1065: ad_apps_private.error_buf := null;
1066: when others then
1067: ad_apps_private.error_buf := 'copy_huge_view('||
1068: view_name||','||fromschema||','||toschema||'): '||
1069: ad_apps_private.error_buf;
1063: --
1064: -- reset main error buffer
1065: ad_apps_private.error_buf := null;
1066: when others then
1067: ad_apps_private.error_buf := 'copy_huge_view('||
1068: view_name||','||fromschema||','||toschema||'): '||
1069: ad_apps_private.error_buf;
1070: raise;
1071:
1065: ad_apps_private.error_buf := null;
1066: when others then
1067: ad_apps_private.error_buf := 'copy_huge_view('||
1068: view_name||','||fromschema||','||toschema||'): '||
1069: ad_apps_private.error_buf;
1070: raise;
1071:
1072: end copy_huge_view;
1073:
1200: return;
1201:
1202: exception
1203: when others then
1204: ad_apps_private.error_buf := 'compare_view_text('||
1205: view_name||','||fromschema||','||toschema||
1206: ','||from_len||','||to_len||','||local_equal||')'||
1207: extra_err_info||': '||
1208: ad_apps_private.error_buf;
1204: ad_apps_private.error_buf := 'compare_view_text('||
1205: view_name||','||fromschema||','||toschema||
1206: ','||from_len||','||to_len||','||local_equal||')'||
1207: extra_err_info||': '||
1208: ad_apps_private.error_buf;
1209: raise;
1210:
1211: end compare_view_text;
1212:
1286:
1287: -- build one line of sql statement in the global variable in
1288: -- the global array variable in to schema.
1289:
1290: ad_apps_private.do_array_assignment(copy_code.to_schema,
1291: c1rec.text, row_count);
1292: end loop;
1293: -- once we have fetched all source
1294: -- then create the object
1298: pragma exception_init(name_already_used, -955);
1299: begin
1300: statement := 'create or replace ';
1301: -- build the first line of the array of sql statement
1302: ad_apps_private.do_array_assignment(copy_code.to_schema, statement, 1);
1303: -- execute the array of statement.
1304: ad_apps_private.do_apps_array_ddl(copy_code.to_schema, 1, row_count);
1305: exception
1306: when name_already_used then
1300: statement := 'create or replace ';
1301: -- build the first line of the array of sql statement
1302: ad_apps_private.do_array_assignment(copy_code.to_schema, statement, 1);
1303: -- execute the array of statement.
1304: ad_apps_private.do_apps_array_ddl(copy_code.to_schema, 1, row_count);
1305: exception
1306: when name_already_used then
1307: -- first reset error buf
1308: ad_apps_private.error_buf := null;
1304: ad_apps_private.do_apps_array_ddl(copy_code.to_schema, 1, row_count);
1305: exception
1306: when name_already_used then
1307: -- first reset error buf
1308: ad_apps_private.error_buf := null;
1309: -- drop any synonym by such name and retry
1310: ad_apps_private.drop_object(copy_code.to_schema,
1311: copy_code.object_name, 'SYNONYM');
1312: ad_apps_private.do_apps_array_ddl(copy_code.to_schema, 1, row_count);
1306: when name_already_used then
1307: -- first reset error buf
1308: ad_apps_private.error_buf := null;
1309: -- drop any synonym by such name and retry
1310: ad_apps_private.drop_object(copy_code.to_schema,
1311: copy_code.object_name, 'SYNONYM');
1312: ad_apps_private.do_apps_array_ddl(copy_code.to_schema, 1, row_count);
1313: end;
1314: exception
1308: ad_apps_private.error_buf := null;
1309: -- drop any synonym by such name and retry
1310: ad_apps_private.drop_object(copy_code.to_schema,
1311: copy_code.object_name, 'SYNONYM');
1312: ad_apps_private.do_apps_array_ddl(copy_code.to_schema, 1, row_count);
1313: end;
1314: exception
1315: when success_with_comp_error then
1316: --
1317: -- Trap and ignore ORA-24344: success with compilation error
1318: -- This only happens on ORACLE 8
1319: --
1320: -- reset main error buffer
1321: ad_apps_private.error_buf := null;
1322: when others then
1323: ad_apps_private.error_buf := 'ad_apps_private.copy_code('||object_name||','
1324: ||object_type||','||from_schema||','||to_schema||'): '
1325: || ad_apps_private.error_buf;
1319: --
1320: -- reset main error buffer
1321: ad_apps_private.error_buf := null;
1322: when others then
1323: ad_apps_private.error_buf := 'ad_apps_private.copy_code('||object_name||','
1324: ||object_type||','||from_schema||','||to_schema||'): '
1325: || ad_apps_private.error_buf;
1326: raise;
1327:
1321: ad_apps_private.error_buf := null;
1322: when others then
1323: ad_apps_private.error_buf := 'ad_apps_private.copy_code('||object_name||','
1324: ||object_type||','||from_schema||','||to_schema||'): '
1325: || ad_apps_private.error_buf;
1326: raise;
1327:
1328: end copy_code;
1329:
1537: raise no_data_found;
1538:
1539: exception
1540: when others then
1541: ad_apps_private.error_buf := 'ad_apps_private.compare_code('||
1542: object_name||','||object_type||','||from_schema||','||to_schema||
1543: ','||comp_level||','||local_equal||')'||extra_err_info||': '||
1544: ad_apps_private.error_buf;
1545: raise;
1540: when others then
1541: ad_apps_private.error_buf := 'ad_apps_private.compare_code('||
1542: object_name||','||object_type||','||from_schema||','||to_schema||
1543: ','||comp_level||','||local_equal||')'||extra_err_info||': '||
1544: ad_apps_private.error_buf;
1545: raise;
1546:
1547: end compare_code;
1548:
1653: --
1654: if found_cust = 'TRUE'
1655: and apps_type(cust_row_index) = 'SYNONYM' then
1656:
1657: ad_apps_private.drop_object(apps_schema, apps_name(cust_row_index),
1658: 'SYNONYM');
1659: end if;
1660: -- end if customized object exists and is synonym
1661: else
1660: -- end if customized object exists and is synonym
1661: else
1662: -- Existing object in APPS should be a synonym. Just drop it.
1663:
1664: ad_apps_private.drop_object(apps_schema, rtrim(drop_rec.object_name),
1665: 'SYNONYM');
1666: end if;
1667: -- end if active exception object
1668: end loop;
1775: -- drop it and then recreate it
1776:
1777: -- Drop synonym
1778:
1779: ad_apps_private.drop_object(apps_schema,
1780: apps_name(cust_row_index), 'SYNONYM');
1781:
1782: -- Recreate synonym
1783: DECLARE
1805: -- end loop to handle exception objects
1806:
1807: exception
1808: when others then
1809: ad_apps_private.error_buf := 'create_base_gs('||base_schema||','||
1810: apps_schema||'): '||what_part||ad_apps_private.error_buf;
1811: raise;
1812: end create_base_gs;
1813:
1806:
1807: exception
1808: when others then
1809: ad_apps_private.error_buf := 'create_base_gs('||base_schema||','||
1810: apps_schema||'): '||what_part||ad_apps_private.error_buf;
1811: raise;
1812: end create_base_gs;
1813:
1814: procedure create_base_gs
1852: else
1853: with_option_print := 'FALSE';
1854: end if;
1855:
1856: ad_apps_private.error_buf := 'ad_apps_private.create_gs('||
1857: object_owner_schema||','||to_schema||','||object_name||
1858: ', '||with_option_print||','||privs||','||
1859: grant_from_schema||'): '||ad_apps_private.error_buf;
1860: raise;
1855:
1856: ad_apps_private.error_buf := 'ad_apps_private.create_gs('||
1857: object_owner_schema||','||to_schema||','||object_name||
1858: ', '||with_option_print||','||privs||','||
1859: grant_from_schema||'): '||ad_apps_private.error_buf;
1860: raise;
1861: end create_gs;
1862:
1863:
1887: --
1888: -- Check for exact synonym match. Drop and recreate synonym
1889: -- if not exact synonym match
1890: --
1891: ad_apps_private.exact_synonym_match(to_schema, c1rec.synonym_name,
1892: from_schema, c1rec.synonym_name, exact_syn_match,
1893: any_obj_w_this_name, type_of_obj);
1894:
1895: if not exact_syn_match then
1910: if type_of_obj = 'PKG_S_AND_B'
1911: or type_of_obj = 'PACKAGE'
1912: or type_of_obj = 'PACKAGE BODY' then
1913: -- existing object is package
1914: ad_apps_private.drop_object(to_schema, c1rec.synonym_name,
1915: 'PACKAGE');
1916: else
1917: -- existing object not package
1918: ad_apps_private.drop_object(to_schema, c1rec.synonym_name,
1914: ad_apps_private.drop_object(to_schema, c1rec.synonym_name,
1915: 'PACKAGE');
1916: else
1917: -- existing object not package
1918: ad_apps_private.drop_object(to_schema, c1rec.synonym_name,
1919: type_of_obj);
1920: end if; -- end if existing object is package
1921: end if; -- end if any existing object with this name in toschema
1922:
1922:
1923: -- create grant/synonym
1924: begin
1925: if grant_from_schema is not null then
1926: ad_apps_private.create_gs(from_schema,to_schema,
1927: c1rec.synonym_name,FALSE,'ALL',grant_from_schema);
1928: else
1929: ad_apps_private.create_gs(from_schema,to_schema,
1930: c1rec.synonym_name,TRUE,'ALL');
1925: if grant_from_schema is not null then
1926: ad_apps_private.create_gs(from_schema,to_schema,
1927: c1rec.synonym_name,FALSE,'ALL',grant_from_schema);
1928: else
1929: ad_apps_private.create_gs(from_schema,to_schema,
1930: c1rec.synonym_name,TRUE,'ALL');
1931: end if;
1932: exception
1933: when name_already_used then
1931: end if;
1932: exception
1933: when name_already_used then
1934: -- first reset error buf
1935: ad_apps_private.error_buf := null;
1936: -- first drop synonym
1937: ad_apps_private.drop_object(to_schema,c1rec.synonym_name,
1938: 'SYNONYM');
1939: -- then create the synonym
1933: when name_already_used then
1934: -- first reset error buf
1935: ad_apps_private.error_buf := null;
1936: -- first drop synonym
1937: ad_apps_private.drop_object(to_schema,c1rec.synonym_name,
1938: 'SYNONYM');
1939: -- then create the synonym
1940: if grant_from_schema is not null then
1941: ad_apps_private.create_gs(from_schema,to_schema,
1937: ad_apps_private.drop_object(to_schema,c1rec.synonym_name,
1938: 'SYNONYM');
1939: -- then create the synonym
1940: if grant_from_schema is not null then
1941: ad_apps_private.create_gs(from_schema,to_schema,
1942: c1rec.synonym_name,FALSE,'ALL',grant_from_schema);
1943: else
1944: ad_apps_private.create_gs(from_schema,to_schema,
1945: c1rec.synonym_name,TRUE,'ALL');
1940: if grant_from_schema is not null then
1941: ad_apps_private.create_gs(from_schema,to_schema,
1942: c1rec.synonym_name,FALSE,'ALL',grant_from_schema);
1943: else
1944: ad_apps_private.create_gs(from_schema,to_schema,
1945: c1rec.synonym_name,TRUE,'ALL');
1946: end if;
1947: end; -- block for creating the grant/synonym
1948: end if; -- not exact synonym match: (re-)create synonym
1949: end loop; -- through all normal synonyms in APPS
1950:
1951: exception
1952: when others then
1953: ad_apps_private.error_buf := 'create_synonyms('||
1954: from_schema||','||to_schema||','||grant_from_schema||')'||
1955: extra_err_info||': '||
1956: ad_apps_private.error_buf;
1957: raise;
1952: when others then
1953: ad_apps_private.error_buf := 'create_synonyms('||
1954: from_schema||','||to_schema||','||grant_from_schema||')'||
1955: extra_err_info||': '||
1956: ad_apps_private.error_buf;
1957: raise;
1958: end create_synonyms;
1959:
1960:
1978: --
1979: -- Check for exact synonym match. Drop and recreate synonym
1980: -- if not exact synonym match
1981: --
1982: ad_apps_private.exact_synonym_match(toschema, c1rec.synonym_name,
1983: fromschema, c1rec.synonym_name, exact_syn_match,
1984: any_obj_w_this_name, type_of_obj);
1985:
1986: if not exact_syn_match then
2001: if type_of_obj = 'PKG_S_AND_B'
2002: or type_of_obj = 'PACKAGE'
2003: or type_of_obj = 'PACKAGE BODY' then
2004: -- existing object is package
2005: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2006: 'PACKAGE');
2007: else
2008: -- existing object not package
2009: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2005: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2006: 'PACKAGE');
2007: else
2008: -- existing object not package
2009: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2010: type_of_obj);
2011: end if; -- end if existing object is package
2012: end if; -- end if any existing object with this name in toschema
2013:
2012: end if; -- end if any existing object with this name in toschema
2013:
2014: -- create grant/synonym
2015: begin
2016: ad_apps_private.create_gs(fromschema,toschema,
2017: c1rec.synonym_name,TRUE,'ALL');
2018: exception
2019: when name_already_used then
2020: -- first reset error buf
2017: c1rec.synonym_name,TRUE,'ALL');
2018: exception
2019: when name_already_used then
2020: -- first reset error buf
2021: ad_apps_private.error_buf := null;
2022: -- first drop synonym
2023: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2024: 'SYNONYM');
2025: -- then create the synonym
2019: when name_already_used then
2020: -- first reset error buf
2021: ad_apps_private.error_buf := null;
2022: -- first drop synonym
2023: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2024: 'SYNONYM');
2025: -- then create the synonym
2026: ad_apps_private.create_gs(fromschema,toschema,
2027: c1rec.synonym_name,TRUE,'ALL');
2022: -- first drop synonym
2023: ad_apps_private.drop_object(toschema, c1rec.synonym_name,
2024: 'SYNONYM');
2025: -- then create the synonym
2026: ad_apps_private.create_gs(fromschema,toschema,
2027: c1rec.synonym_name,TRUE,'ALL');
2028: end; -- block for creating the grant/synonym
2029: end if; -- not exact synonym match: (re-)create synonym
2030: end loop; -- through all normal synonyms in APPS
2030: end loop; -- through all normal synonyms in APPS
2031:
2032: exception
2033: when others then
2034: ad_apps_private.error_buf := 'copy_odd_synonyms('||
2035: fromschema||','||toschema||')'||extra_err_info||': '||
2036: ad_apps_private.error_buf;
2037: raise;
2038: end copy_odd_synonyms;
2032: exception
2033: when others then
2034: ad_apps_private.error_buf := 'copy_odd_synonyms('||
2035: fromschema||','||toschema||')'||extra_err_info||': '||
2036: ad_apps_private.error_buf;
2037: raise;
2038: end copy_odd_synonyms;
2039:
2040:
2106: end loop;
2107: exception
2108: when others then
2109: dbms_sql.close_cursor(c);
2110: ad_apps_private.error_buf := 'statement='||
2111: statement||':'||
2112: ad_apps_private.error_buf;
2113: raise;
2114: end;
2108: when others then
2109: dbms_sql.close_cursor(c);
2110: ad_apps_private.error_buf := 'statement='||
2111: statement||':'||
2112: ad_apps_private.error_buf;
2113: raise;
2114: end;
2115:
2116:
2137: end loop;
2138: exception
2139: when others then
2140: dbms_sql.close_cursor(c);
2141: ad_apps_private.error_buf := 'statement='||
2142: statement||':'||
2143: ad_apps_private.error_buf;
2144: raise;
2145: end;
2139: when others then
2140: dbms_sql.close_cursor(c);
2141: ad_apps_private.error_buf := 'statement='||
2142: statement||':'||
2143: ad_apps_private.error_buf;
2144: raise;
2145: end;
2146:
2147:
2219: end loop;
2220: exception
2221: when others then
2222: dbms_sql.close_cursor(c);
2223: ad_apps_private.error_buf := 'statement='||
2224: statement||':'||
2225: ad_apps_private.error_buf;
2226: raise;
2227: end;
2221: when others then
2222: dbms_sql.close_cursor(c);
2223: ad_apps_private.error_buf := 'statement='||
2224: statement||':'||
2225: ad_apps_private.error_buf;
2226: raise;
2227: end;
2228:
2229: -- Only recreate the view if:
2281: declare
2282: name_already_used exception;
2283: pragma exception_init(name_already_used, -955);
2284: begin
2285: ad_apps_private.do_apps_ddl(apps_schema,statement);
2286: exception
2287: when name_already_used then
2288: -- first reset error buf
2289: ad_apps_private.error_buf := null;
2285: ad_apps_private.do_apps_ddl(apps_schema,statement);
2286: exception
2287: when name_already_used then
2288: -- first reset error buf
2289: ad_apps_private.error_buf := null;
2290: -- drop synonym and try view create again
2291: ad_apps_private.drop_object(apps_schema,
2292: l_table_name, 'SYNONYM');
2293: ad_apps_private.do_apps_ddl(apps_schema,statement);
2287: when name_already_used then
2288: -- first reset error buf
2289: ad_apps_private.error_buf := null;
2290: -- drop synonym and try view create again
2291: ad_apps_private.drop_object(apps_schema,
2292: l_table_name, 'SYNONYM');
2293: ad_apps_private.do_apps_ddl(apps_schema,statement);
2294: end;
2295:
2289: ad_apps_private.error_buf := null;
2290: -- drop synonym and try view create again
2291: ad_apps_private.drop_object(apps_schema,
2292: l_table_name, 'SYNONYM');
2293: ad_apps_private.do_apps_ddl(apps_schema,statement);
2294: end;
2295:
2296: exception
2297: when success_with_comp_error then
2299: -- Trap and ignore ORA-24344: success with compilation error
2300: -- This only happens on ORACLE 8
2301: --
2302: -- reset main error buffer
2303: ad_apps_private.error_buf := null;
2304: end;
2305: end if; -- view_is_old
2306: else
2307: -- no more oracle views to process for this schema
2312:
2313: exception
2314: when others then
2315: dbms_sql.close_cursor(c);
2316: ad_apps_private.error_buf := 'statement='||statement||': '||
2317: ad_apps_private.error_buf;
2318: raise;
2319: end;
2320:
2313: exception
2314: when others then
2315: dbms_sql.close_cursor(c);
2316: ad_apps_private.error_buf := 'statement='||statement||': '||
2317: ad_apps_private.error_buf;
2318: raise;
2319: end;
2320:
2321: else
2326: end loop;
2327: exception
2328: when others then
2329: dbms_sql.close_cursor(oracle_id_cursor);
2330: ad_apps_private.error_buf := 'create_special_views('||install_group_num||
2331: ','||aol_schema||
2332: ','||apps_schema||',create_mls_views): '||
2333: ad_apps_private.error_buf;
2334: raise;
2329: dbms_sql.close_cursor(oracle_id_cursor);
2330: ad_apps_private.error_buf := 'create_special_views('||install_group_num||
2331: ','||aol_schema||
2332: ','||apps_schema||',create_mls_views): '||
2333: ad_apps_private.error_buf;
2334: raise;
2335: end create_special_views;
2336:
2337:
2357: -- Check if view exists in destination schema,
2358: -- and create it if it's not already there
2359: --
2360: if v_rec.dest_len is null then
2361: ad_apps_private.copy_view(v_rec.view_name, fromschema, toschema);
2362: else
2363: --
2364: -- View exists in both schemas
2365: --
2366: -- Compare view lengths. Re-create view in dest schema if the
2367: -- two views have different lengths.
2368: --
2369: if v_rec.source_len <> v_rec.dest_len then
2370: ad_apps_private.copy_view(v_rec.view_name, fromschema, toschema);
2371: else
2372: --
2373: -- View lengths equal. Compare actual view text.
2374: --
2372: --
2373: -- View lengths equal. Compare actual view text.
2374: --
2375:
2376: ad_apps_private.compare_view_text(v_rec.view_name, fromschema,
2377: toschema, v_rec.source_len, v_rec.dest_len, comp_result);
2378:
2379: -- Only copy view to destination schema if text not equal
2380:
2378:
2379: -- Only copy view to destination schema if text not equal
2380:
2381: if comp_result = 'FALSE' then
2382: ad_apps_private.copy_view(v_rec.view_name, fromschema, toschema);
2383: end if;
2384:
2385: end if; -- view lengths equal
2386: end if; -- view exists in dest schema
2386: end if; -- view exists in dest schema
2387: end loop;
2388: exception
2389: when others then
2390: ad_apps_private.error_buf := 'copy_views('||aoluser||','||fromschema||','||
2391: toschema||'): '||ad_apps_private.error_buf;
2392: raise;
2393: end copy_views;
2394:
2387: end loop;
2388: exception
2389: when others then
2390: ad_apps_private.error_buf := 'copy_views('||aoluser||','||fromschema||','||
2391: toschema||'): '||ad_apps_private.error_buf;
2392: raise;
2393: end copy_views;
2394:
2395:
2455: if src_rec.name2 is null then
2456:
2457: -- object not in destination schema, so copy it to destination schema
2458:
2459: ad_apps_private.copy_code(src_rec.object_name, src_rec.object_type,
2460: fromschema, toschema);
2461:
2462: else
2463: -- get header information for object in source schema
2496: -- copy source to destination
2497:
2498: if dst_header is null then
2499:
2500: ad_apps_private.copy_code(src_rec.object_name, src_rec.object_type,
2501: fromschema, toschema);
2502:
2503: else
2504:
2507: -- possibly do more extensive comparison if header lines same
2508:
2509: if src_header <> dst_header then
2510:
2511: ad_apps_private.copy_code(src_rec.object_name,
2512: src_rec.object_type, fromschema, toschema);
2513:
2514: else
2515:
2515:
2516: -- header strings are identical
2517: -- do object comparison according to compare_level
2518:
2519: ad_apps_private.compare_code(src_rec.object_name,
2520: src_rec.object_type, fromschema, toschema,
2521: compare_level, objs_equal);
2522:
2523: -- copy source to dest if not equal
2523: -- copy source to dest if not equal
2524:
2525: if objs_equal = 'FALSE' then
2526:
2527: ad_apps_private.copy_code(src_rec.object_name,
2528: src_rec.object_type, fromschema, toschema);
2529:
2530: end if; -- source and destination objects not identical
2531:
2538: -- no header information in source schema object
2539: -- do full object comparison
2540: -- (even if compare_level <> 'full')
2541:
2542: ad_apps_private.compare_code(src_rec.object_name,
2543: src_rec.object_type, fromschema, toschema,
2544: 'full', objs_equal);
2545:
2546: -- copy source to dest if not equal
2546: -- copy source to dest if not equal
2547:
2548: if objs_equal = 'FALSE' then
2549:
2550: ad_apps_private.copy_code(src_rec.object_name,
2551: src_rec.object_type, fromschema, toschema);
2552:
2553: end if; -- source and destination objects not identical
2554:
2558: end loop; -- loop over all stored progs in source schema
2559:
2560: exception
2561: when others then
2562: ad_apps_private.error_buf := 'copy_stored_progs('||fromschema||','||
2563: toschema||','||p_object_type||','||p_subset||','||
2564: compare_level||'): '||ad_apps_private.error_buf;
2565: raise;
2566: end copy_stored_progs;
2560: exception
2561: when others then
2562: ad_apps_private.error_buf := 'copy_stored_progs('||fromschema||','||
2563: toschema||','||p_object_type||','||p_subset||','||
2564: compare_level||'): '||ad_apps_private.error_buf;
2565: raise;
2566: end copy_stored_progs;
2567:
2568:
2679: -- end if no exact synonym match
2680:
2681: exception
2682: when others then
2683: ad_apps_private.error_buf := 'exact_synonym_match('||syn_own_schema||
2684: ','||syn_name||','||tab_owner||','||tab_name||'): '||
2685: ad_apps_private.error_buf;
2686: raise;
2687: end exact_synonym_match;
2681: exception
2682: when others then
2683: ad_apps_private.error_buf := 'exact_synonym_match('||syn_own_schema||
2684: ','||syn_name||','||tab_owner||','||tab_name||'): '||
2685: ad_apps_private.error_buf;
2686: raise;
2687: end exact_synonym_match;
2688:
2689:
2905:
2906: -- dbms_output.put_line('('||obj_levels(i)||') '||statement);
2907:
2908: begin
2909: ad_apps_private.do_apps_ddl(recompile_schema, statement);
2910: exception
2911: when others then
2912: ad_apps_private.error_buf := null;
2913: end;
2908: begin
2909: ad_apps_private.do_apps_ddl(recompile_schema, statement);
2910: exception
2911: when others then
2912: ad_apps_private.error_buf := null;
2913: end;
2914:
2915: end if;
2916: -- end if object exists in desc schema
2923: -- end loop to compile invalid objects for all levels
2924:
2925: exception
2926: when others then
2927: ad_apps_private.error_buf := 'recomp_referenced_objs('||object_name||
2928: ','||obj_list_schema||','||recompile_schema||'): '||
2929: ad_apps_private.error_buf;
2930: raise;
2931: end recomp_referenced_objs;
2925: exception
2926: when others then
2927: ad_apps_private.error_buf := 'recomp_referenced_objs('||object_name||
2928: ','||obj_list_schema||','||recompile_schema||'): '||
2929: ad_apps_private.error_buf;
2930: raise;
2931: end recomp_referenced_objs;
2932:
2933:
2964: out_column_text := column_text;
2965:
2966: exception
2967: when others then
2968: ad_apps_private.error_buf := 'ad_apps_private.build_view_columns('||
2969: from_schema||','||view_name||',out_column_text): '||
2970: ad_apps_private.error_buf;
2971: raise;
2972: end build_view_columns;
2966: exception
2967: when others then
2968: ad_apps_private.error_buf := 'ad_apps_private.build_view_columns('||
2969: from_schema||','||view_name||',out_column_text): '||
2970: ad_apps_private.error_buf;
2971: raise;
2972: end build_view_columns;
2973:
2974:
3022: dbms_output.put_line('-');
3023:
3024: exception
3025: when others then
3026: ad_apps_private.error_buf := 'show_exception_list: '||
3027: ad_apps_private.error_buf;
3028: raise;
3029: end show_exception_list;
3030:
3023:
3024: exception
3025: when others then
3026: ad_apps_private.error_buf := 'show_exception_list: '||
3027: ad_apps_private.error_buf;
3028: raise;
3029: end show_exception_list;
3030:
3031:
3500: -- end if initialize list
3501:
3502: exception
3503: when others then
3504: ad_apps_private.error_buf := 'load_exception_list: '||
3505: ad_apps_private.error_buf;
3506: raise;
3507: end load_exception_list;
3508:
3501:
3502: exception
3503: when others then
3504: ad_apps_private.error_buf := 'load_exception_list: '||
3505: ad_apps_private.error_buf;
3506: raise;
3507: end load_exception_list;
3508:
3509:
3593:
3594: whereami := ' C ';
3595:
3596: if trigger_is_base then
3597: ad_apps_private.exact_synonym_match(base_schema_name,
3598: trigger_obj_name(i), null, null,
3599: matches_exactly, any_obj_w_this_name, type_of_existing_obj);
3600: else
3601: ad_apps_private.exact_synonym_match(apps_schema_name,
3597: ad_apps_private.exact_synonym_match(base_schema_name,
3598: trigger_obj_name(i), null, null,
3599: matches_exactly, any_obj_w_this_name, type_of_existing_obj);
3600: else
3601: ad_apps_private.exact_synonym_match(apps_schema_name,
3602: trigger_obj_name(i), null, null,
3603: matches_exactly, any_obj_w_this_name, type_of_existing_obj);
3604: end if;
3605:
3620: whereami := ' E ';
3621:
3622: if apps_type(i) = 'SYNONYM' then
3623: if points_to_base then
3624: ad_apps_private.exact_synonym_match(apps_schema_name,apps_name(i),
3625: base_schema_name, points_to_name(i), matches_exactly,
3626: any_obj_w_this_name, type_of_existing_obj);
3627: else
3628: ad_apps_private.exact_synonym_match(apps_schema_name,apps_name(i),
3624: ad_apps_private.exact_synonym_match(apps_schema_name,apps_name(i),
3625: base_schema_name, points_to_name(i), matches_exactly,
3626: any_obj_w_this_name, type_of_existing_obj);
3627: else
3628: ad_apps_private.exact_synonym_match(apps_schema_name,apps_name(i),
3629: apps_schema_name, points_to_name(i), matches_exactly,
3630: any_obj_w_this_name, type_of_existing_obj);
3631: end if;
3632: else
3629: apps_schema_name, points_to_name(i), matches_exactly,
3630: any_obj_w_this_name, type_of_existing_obj);
3631: end if;
3632: else
3633: ad_apps_private.exact_synonym_match(apps_schema_name,apps_name(i),
3634: null, null, matches_exactly, any_obj_w_this_name,
3635: type_of_existing_obj);
3636: end if;
3637:
3701: -- end if base object is active exception object
3702:
3703: exception
3704: when others then
3705: ad_apps_private.error_buf := 'matching_exception_object('||
3706: base_schema_name||','||base_object_name||','||
3707: base_object_type||','||except_type||','||
3708: apps_schema_name||')<'||whereami||'> : '||
3709: ad_apps_private.error_buf;
3705: ad_apps_private.error_buf := 'matching_exception_object('||
3706: base_schema_name||','||base_object_name||','||
3707: base_object_type||','||except_type||','||
3708: apps_schema_name||')<'||whereami||'> : '||
3709: ad_apps_private.error_buf;
3710: raise;
3711: end matching_exception_object;
3712:
3713:
3725: where read_only_flag = 'K';
3726: begin
3727: -- only perform the work if the variables are null, meaning that
3728: -- this routine has not been called before
3729: if ad_apps_private.is_mls is null
3730: or ad_apps_private.is_mc is null then
3731: -- get values for is_mc and is_mls
3732: declare
3733: x varchar2(30);
3726: begin
3727: -- only perform the work if the variables are null, meaning that
3728: -- this routine has not been called before
3729: if ad_apps_private.is_mls is null
3730: or ad_apps_private.is_mc is null then
3731: -- get values for is_mc and is_mls
3732: declare
3733: x varchar2(30);
3734: y varchar2(30);
3750:
3751: if x = 'Y' then
3752: -- Fixed bug 3258312 : Although MRC flag is at 'Y', someone
3753: -- may have dropped it or the release might be 11.5.10 or more.
3754: -- In both these cases, we have to set "ad_apps_private.is_mc"
3755: -- to 'FALSE'.
3756:
3757: -- get mrc schema name from FND_ORACLE_USERID
3758:
3767: -- Reset MRC flag to FALSE.
3768:
3769: close GET_MRC_SCHEMA_NAME;
3770:
3771: ad_apps_private.is_mc := FALSE;
3772: else
3773:
3774: -- MRC schema registered in FND_ORACLE_USERID, Check in DBA_USERS.
3775:
3774: -- MRC schema registered in FND_ORACLE_USERID, Check in DBA_USERS.
3775:
3776: close GET_MRC_SCHEMA_NAME;
3777:
3778: if ad_apps_private.check_if_schema_exists(l_mrc_schema_name) then
3779:
3780: -- Fixed bug 3353468 to resolve a runtime issue for
3781: -- 11.5.10. Check if the release>=11.5.10. if yes, MRC
3782: -- is not enabled
3811: l_rel_comp_result := compare_releases(l_release_name ,
3812: '11.5.9');
3813:
3814: if (l_rel_comp_result = TRUE) then
3815: ad_apps_private.is_mc := TRUE;
3816: else
3817: ad_apps_private.is_mc := FALSE;
3818: end if;
3819:
3813:
3814: if (l_rel_comp_result = TRUE) then
3815: ad_apps_private.is_mc := TRUE;
3816: else
3817: ad_apps_private.is_mc := FALSE;
3818: end if;
3819:
3820: else
3821: -- no MRC schema in DBA_USERS!
3818: end if;
3819:
3820: else
3821: -- no MRC schema in DBA_USERS!
3822: ad_apps_private.is_mc := FALSE;
3823: end if;
3824:
3825: end if;
3826: -- end if block for MRC schema registered in FND_ORACLE_USERID
3826: -- end if block for MRC schema registered in FND_ORACLE_USERID
3827:
3828: else -- if not fnd_product_groups.multi_currency_flag
3829:
3830: ad_apps_private.is_mc := FALSE;
3831:
3832: end if;
3833:
3834: if y = 'Y' then
3831:
3832: end if;
3833:
3834: if y = 'Y' then
3835: ad_apps_private.is_mls := TRUE;
3836: else
3837: ad_apps_private.is_mls := FALSE;
3838: end if;
3839: dbms_sql.close_cursor(c);
3833:
3834: if y = 'Y' then
3835: ad_apps_private.is_mls := TRUE;
3836: else
3837: ad_apps_private.is_mls := FALSE;
3838: end if;
3839: dbms_sql.close_cursor(c);
3840: else
3841: raise no_data_found;
3842: end if;
3843: exception
3844: when others then
3845: dbms_sql.close_cursor(c);
3846: ad_apps_private.error_buf := 'statement='||
3847: statement||':'||
3848: ad_apps_private.error_buf;
3849: raise;
3850: end;
3844: when others then
3845: dbms_sql.close_cursor(c);
3846: ad_apps_private.error_buf := 'statement='||
3847: statement||':'||
3848: ad_apps_private.error_buf;
3849: raise;
3850: end;
3851:
3852: end if;
3852: end if;
3853:
3854: exception
3855: when others then
3856: ad_apps_private.error_buf := 'initialize('||aol_schema||'): '||
3857: ad_apps_private.error_buf;
3858: raise;
3859: end initialize;
3860:
3853:
3854: exception
3855: when others then
3856: ad_apps_private.error_buf := 'initialize('||aol_schema||'): '||
3857: ad_apps_private.error_buf;
3858: raise;
3859: end initialize;
3860:
3861:
3921:
3922: end compare_releases;
3923:
3924:
3925: end ad_apps_private;