DBA Data[Home] [Help]

APPS.AD_ZD_SEED dependencies on AD_ZD

Line 1: PACKAGE BODY AD_ZD_SEED AS

1: PACKAGE BODY AD_ZD_SEED AS
2: /* $Header: ADZDSMB.pls 120.73.12020000.17 2013/05/09 12:39:01 rahulshr ship $ */
3:
4: C_PACKAGE CONSTANT VARCHAR2(80) := 'ad.plsql.ad_zd_seed.';
5:

Line 4: C_PACKAGE CONSTANT VARCHAR2(80) := 'ad.plsql.ad_zd_seed.';

1: PACKAGE BODY AD_ZD_SEED AS
2: /* $Header: ADZDSMB.pls 120.73.12020000.17 2013/05/09 12:39:01 rahulshr ship $ */
3:
4: C_PACKAGE CONSTANT VARCHAR2(80) := 'ad.plsql.ad_zd_seed.';
5:
6: /*
7: ** --------------------------------------------------------------------
8: ** Edition Data Storage - Public Helper Functions

Line 54: ad_zd.log(x_module, x_level, x_message);

50:
51: -- log shortcut
52: procedure LOG(X_MODULE varchar2, X_LEVEL varchar2, X_MESSAGE varchar2) is
53: begin
54: ad_zd.log(x_module, x_level, x_message);
55: end;
56:
57: -- error shortcut
58: procedure ERROR(X_MODULE varchar2, X_MESSAGE varchar2) is

Line 60: ad_zd.error(x_module, x_message);

56:
57: -- error shortcut
58: procedure ERROR(X_MODULE varchar2, X_MESSAGE varchar2) is
59: begin
60: ad_zd.error(x_module, x_message);
61: end;
62:
63: -- exec shortcut
64: procedure EXEC(X_SQL in varchar2, X_LOG_MOD in varchar2, X_IGNORE in boolean default false) is

Line 66: ad_zd.exec(x_sql, x_log_mod, x_ignore);

62:
63: -- exec shortcut
64: procedure EXEC(X_SQL in varchar2, X_LOG_MOD in varchar2, X_IGNORE in boolean default false) is
65: begin
66: ad_zd.exec(x_sql, x_log_mod, x_ignore);
67: end;
68:
69: -- Get seed data table details from synonym, and validate along the way
70: procedure TRANSLATE_SYNONYM(

Line 86: where owner = ad_zd.apps_schema

82: begin
83: select s.table_owner, s.table_name
84: into l_owner, l_view_name
85: from dba_synonyms s
86: where owner = ad_zd.apps_schema
87: and synonym_name = x_synonym_name;
88: exception when no_data_found then
89: error(x_module, 'Synonym does not exist: '||nvl(x_synonym_name,''));
90: end;

Line 94: l_table_name := ad_zd_table.ev_table(l_owner, l_view_name);

90: end;
91:
92: -- Get Table Name
93: begin
94: l_table_name := ad_zd_table.ev_table(l_owner, l_view_name);
95: exception when no_data_found then
96: if x_check_seed then
97: error(x_module, 'Synonym does not point to an editioning view: '||x_synonym_name);
98: else

Line 105: if ad_zd_table.is_seed(l_owner, l_table_name) = 'N' then

101: end;
102:
103: -- Validate that table suppports Editioned Data Storage
104: if x_check_seed then
105: if ad_zd_table.is_seed(l_owner, l_table_name) = 'N' then
106: error(x_module, 'Synonym does not point to a seed data table: '||x_synonym_name);
107: end if;
108: end if;
109:

Line 140: where owner = ad_zd.apps_schema

136: begin
137: begin
138: select 1 into l_dummy
139: from dba_source
140: where owner = ad_zd.apps_schema
141: and name = ad_zd_seed.eds_function(x_table_name)
142: and type = 'FUNCTION'
143: and instr(text, ad_zd.get_edition('PATCH')) <> 0;
144: l_retval := TRUE;

Line 141: and name = ad_zd_seed.eds_function(x_table_name)

137: begin
138: select 1 into l_dummy
139: from dba_source
140: where owner = ad_zd.apps_schema
141: and name = ad_zd_seed.eds_function(x_table_name)
142: and type = 'FUNCTION'
143: and instr(text, ad_zd.get_edition('PATCH')) <> 0;
144: l_retval := TRUE;
145: exception when no_data_found then

Line 143: and instr(text, ad_zd.get_edition('PATCH')) <> 0;

139: from dba_source
140: where owner = ad_zd.apps_schema
141: and name = ad_zd_seed.eds_function(x_table_name)
142: and type = 'FUNCTION'
143: and instr(text, ad_zd.get_edition('PATCH')) <> 0;
144: l_retval := TRUE;
145: exception when no_data_found then
146: l_retval := FALSE;
147: end;

Line 257: and table_name in (x_tab_name, ad_zd_table.ev_view(x_tab_name))

253: cursor C_TRIG_CUR(x_tab_owner varchar2, x_tab_name varchar2) is
254: select owner, trigger_name
255: from dba_triggers
256: where table_owner = x_tab_owner
257: and table_name in (x_tab_name, ad_zd_table.ev_view(x_tab_name))
258: and trigger_name <> ad_zd_seed.eds_trigger(x_tab_name)
259: and crossedition = 'NO';
260:
261: begin

Line 258: and trigger_name <> ad_zd_seed.eds_trigger(x_tab_name)

254: select owner, trigger_name
255: from dba_triggers
256: where table_owner = x_tab_owner
257: and table_name in (x_tab_name, ad_zd_table.ev_view(x_tab_name))
258: and trigger_name <> ad_zd_seed.eds_trigger(x_tab_name)
259: and crossedition = 'NO';
260:
261: begin
262: for trgrec in c_trig_cur(x_owner, x_table_name) loop

Line 278: if ad_zd_table.is_seed(x_owner, x_table_name) = 'N' then

274: C_MODULE varchar2(80) := c_package||'create_zd_column';
275: L_STMT varchar2(2000);
276:
277: begin
278: if ad_zd_table.is_seed(x_owner, x_table_name) = 'N' then
279: log(c_module, 'EVENT', 'Creating EDS Striping Column on '||x_owner||'.'||x_table_name);
280: l_stmt := 'alter table '||x_owner||'."'||x_table_name||
281: '" add (ZD_EDITION_NAME varchar2(30) default '''||x_edition_name||''' not null)';
282: else

Line 403: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);

399: X_EDITION_NAME in varchar2,
400: X_SAVE_BODY in out nocopy varchar2)
401: is
402: C_MODULE varchar2(80) := c_package||'create_guard';
403: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);
404: L_TRIG_NAME varchar2(30) := ad_zd_seed.eds_trigger(x_table_name);
405: L_TRIG_BODY varchar2(32000);
406: L_TRIG_STMT varchar2(32000);
407:

Line 404: L_TRIG_NAME varchar2(30) := ad_zd_seed.eds_trigger(x_table_name);

400: X_SAVE_BODY in out nocopy varchar2)
401: is
402: C_MODULE varchar2(80) := c_package||'create_guard';
403: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);
404: L_TRIG_NAME varchar2(30) := ad_zd_seed.eds_trigger(x_table_name);
405: L_TRIG_BODY varchar2(32000);
406: L_TRIG_STMT varchar2(32000);
407:
408: cursor C_TRIG_CUR (x_tab_owner varchar2, x_tab_name varchar2, x_trig_name varchar2) is

Line 450: l_trig_stmt := ' create or replace trigger "'||ad_zd.apps_schema||'"."'||l_trig_name||'"'||

446: end if;
447:
448: -- Create trigger statement
449: log(c_module, 'EVENT', 'Creating EDS Guard Trigger '||l_trig_name);
450: l_trig_stmt := ' create or replace trigger "'||ad_zd.apps_schema||'"."'||l_trig_name||'"'||
451: ' before insert or update or delete on "'||x_table_owner||'"."'||l_ev_name||'"'||
452: ' for each row '|| l_trig_body;
453: exec(l_trig_stmt, c_module);
454:

Line 472: L_POLICY_NAME varchar2(30) := ad_zd_seed.eds_policy;

468: X_EDITION_NAME in varchar2)
469: is
470: C_MODULE varchar2(80) := c_package||'create_policy';
471: L_CUR integer;
472: L_POLICY_NAME varchar2(30) := ad_zd_seed.eds_policy;
473: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);
474: L_POLICY_FUNC varchar2(30) := ad_zd_seed.eds_function(x_table_name);
475: L_STMT varchar2(1000);
476: L_TEXT varchar2(4000);

Line 473: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);

469: is
470: C_MODULE varchar2(80) := c_package||'create_policy';
471: L_CUR integer;
472: L_POLICY_NAME varchar2(30) := ad_zd_seed.eds_policy;
473: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);
474: L_POLICY_FUNC varchar2(30) := ad_zd_seed.eds_function(x_table_name);
475: L_STMT varchar2(1000);
476: L_TEXT varchar2(4000);
477:

Line 474: L_POLICY_FUNC varchar2(30) := ad_zd_seed.eds_function(x_table_name);

470: C_MODULE varchar2(80) := c_package||'create_policy';
471: L_CUR integer;
472: L_POLICY_NAME varchar2(30) := ad_zd_seed.eds_policy;
473: L_EV_NAME varchar2(30) := ad_zd_table.ev_view(x_table_name);
474: L_POLICY_FUNC varchar2(30) := ad_zd_seed.eds_function(x_table_name);
475: L_STMT varchar2(1000);
476: L_TEXT varchar2(4000);
477:
478: cursor C_POLICY_CUR (x_tab_owner varchar2, x_tab_name varchar2) is

Line 482: and object_name = ad_zd_table.ev_view(x_tab_name)

478: cursor C_POLICY_CUR (x_tab_owner varchar2, x_tab_name varchar2) is
479: select policy_name
480: from dba_policies
481: where object_owner = x_tab_owner
482: and object_name = ad_zd_table.ev_view(x_tab_name)
483: and policy_name = ad_zd_seed.eds_policy;
484:
485: begin
486:

Line 483: and policy_name = ad_zd_seed.eds_policy;

479: select policy_name
480: from dba_policies
481: where object_owner = x_tab_owner
482: and object_name = ad_zd_table.ev_view(x_tab_name)
483: and policy_name = ad_zd_seed.eds_policy;
484:
485: begin
486:
487: -- Install VPD Function

Line 491: '"'||ad_zd.apps_schema||'"."'||l_policy_func||'"(x_schema in varchar2, x_table in varchar2) '||

487: -- Install VPD Function
488: log(c_module, 'EVENT', 'Creating EDS Filter Function '||l_policy_func);
489: l_stmt :=
490: 'create or replace function '||
491: '"'||ad_zd.apps_schema||'"."'||l_policy_func||'"(x_schema in varchar2, x_table in varchar2) '||
492: 'return varchar2 is '||
493: 'begin return ''ZD_EDITION_NAME = '''''||x_edition_name||'''''''; end;';
494: exec (l_stmt, c_module);
495:

Line 505: function_schema => ad_zd.apps_schema,

501: dbms_rls.add_policy(
502: object_schema => x_owner,
503: object_name => l_ev_name,
504: policy_name => l_policy_name,
505: function_schema => ad_zd.apps_schema,
506: policy_function => '"'||l_policy_func||'"',
507: policy_type => dbms_rls.static,
508: statement_types => 'select, update, delete, index');
509: end if;

Line 528: L_TRIG_NAME varchar2(30) := ad_zd_seed.eds_fcet(x_table_name);

524: X_TABLE_NAME in varchar2,
525: X_COPY_DATA in boolean)
526: is
527: C_MODULE varchar2(80) := c_package||'create_sync';
528: L_TRIG_NAME varchar2(30) := ad_zd_seed.eds_fcet(x_table_name);
529: L_STMT varchar2(32767);
530: L_SAVE_STMT varchar2(32767); /* save data values */
531: L_OLD_KEY_STMT varchar2(3000); /* get old key values */
532: L_NEW_KEY_STMT varchar2(3000); /* get new key values */

Line 624: exec('insert into "'||x_table_owner||'"."'||ad_zd_table.ev_view(x_table_name)||

620: if l_first then
621: log(c_module, 'WARNING', 'Table does not support Synchronization. No Primary Key or Unique Index defined');
622: if x_copy_data then
623: log(c_module, 'EVENT', 'Copy Seed Data using insert-select: '||x_table_name);
624: exec('insert into "'||x_table_owner||'"."'||ad_zd_table.ev_view(x_table_name)||
625: '" select * from "'||x_table_owner||'"."'||ad_zd_table.ev_view(x_table_name)||'"',
626: c_module);
627: end if;
628: return;

Line 625: '" select * from "'||x_table_owner||'"."'||ad_zd_table.ev_view(x_table_name)||'"',

621: log(c_module, 'WARNING', 'Table does not support Synchronization. No Primary Key or Unique Index defined');
622: if x_copy_data then
623: log(c_module, 'EVENT', 'Copy Seed Data using insert-select: '||x_table_name);
624: exec('insert into "'||x_table_owner||'"."'||ad_zd_table.ev_view(x_table_name)||
625: '" select * from "'||x_table_owner||'"."'||ad_zd_table.ev_view(x_table_name)||'"',
626: c_module);
627: end if;
628: return;
629: end if;

Line 653: -- The trigger is optimized for the initial data copy where a call to ad_zd_table.apply

649: --
650: -- Create statement
651: -- Note: Inserts are converted to update, in the "updating" section of the trigger,
652: -- this is intentional.
653: -- The trigger is optimized for the initial data copy where a call to ad_zd_table.apply
654: -- is used to copy the data. In this case a fake update is issues to every row in the
655: -- table.
656: -- It is understood that this is not optimal for propagating ongoing changes, but
657: -- is is expected that very few updates will be issued to seed data in the RUN edition

Line 659: l_stmt:='create or replace trigger '||ad_zd.apps_schema||'."'||l_trig_name||'"'

655: -- table.
656: -- It is understood that this is not optimal for propagating ongoing changes, but
657: -- is is expected that very few updates will be issued to seed data in the RUN edition
658: --
659: l_stmt:='create or replace trigger '||ad_zd.apps_schema||'."'||l_trig_name||'"'
660: ||NL||' for insert or update or delete on '||x_table_owner||'.'||x_table_name
661: ||NL||' forward crossedition '||l_disable||' compound trigger '
662: ||NL||' type DATA_T is table of '||x_table_owner||'.'||x_table_name||'%ROWTYPE index by simple_integer;'
663: ||NL|| l_rec_key_stmt

Line 739: ad_zd_table.apply(l_trig_name);

735: log(c_module, 'EVENT', 'Creating EDS Sync Trigger '||l_trig_name);
736: exec (l_stmt, c_module);
737:
738: if x_copy_data then
739: ad_zd_table.apply(l_trig_name);
740: end if;
741:
742: log(c_module, 'PROCEDURE', 'end');
743: end CREATE_SYNC;

Line 788: if ad_zd.is_editions_enabled = 'N' then

784: log(c_module, 'PROCEDURE', 'begin: '||x_table_name);
785: translate_synonym(c_module, x_table_name, false, l_table_owner, l_table_name);
786:
787: -- If database is not editioned, save DDL for later execution
788: if ad_zd.is_editions_enabled = 'N' then
789: -- get parallel servers info
790: select to_number(value) into v_parallel
791: from v$parameter where name='parallel_max_servers';
792:

Line 793: ad_zd_parallel_exec.load('UPGRADE_SEED',

789: -- get parallel servers info
790: select to_number(value) into v_parallel
791: from v$parameter where name='parallel_max_servers';
792:
793: ad_zd_parallel_exec.load('UPGRADE_SEED',
794: 'begin '||ad_zd.apps_schema||'.ad_zd_seed.upgrade('''||x_table_name||'''); end;',
795: true);
796: ad_zd_parallel_exec.load('COLLECT_STATS',
797: 'begin '||ad_zd.apps_schema||'.fnd_stats.gather_table_stats('''||l_table_owner||''','''||x_table_name||''', 100, '||v_parallel||'); end;',

Line 794: 'begin '||ad_zd.apps_schema||'.ad_zd_seed.upgrade('''||x_table_name||'''); end;',

790: select to_number(value) into v_parallel
791: from v$parameter where name='parallel_max_servers';
792:
793: ad_zd_parallel_exec.load('UPGRADE_SEED',
794: 'begin '||ad_zd.apps_schema||'.ad_zd_seed.upgrade('''||x_table_name||'''); end;',
795: true);
796: ad_zd_parallel_exec.load('COLLECT_STATS',
797: 'begin '||ad_zd.apps_schema||'.fnd_stats.gather_table_stats('''||l_table_owner||''','''||x_table_name||''', 100, '||v_parallel||'); end;',
798: true);

Line 796: ad_zd_parallel_exec.load('COLLECT_STATS',

792:
793: ad_zd_parallel_exec.load('UPGRADE_SEED',
794: 'begin '||ad_zd.apps_schema||'.ad_zd_seed.upgrade('''||x_table_name||'''); end;',
795: true);
796: ad_zd_parallel_exec.load('COLLECT_STATS',
797: 'begin '||ad_zd.apps_schema||'.fnd_stats.gather_table_stats('''||l_table_owner||''','''||x_table_name||''', 100, '||v_parallel||'); end;',
798: true);
799: commit;
800: log(c_module, 'PROCEDURE', 'end');

Line 797: 'begin '||ad_zd.apps_schema||'.fnd_stats.gather_table_stats('''||l_table_owner||''','''||x_table_name||''', 100, '||v_parallel||'); end;',

793: ad_zd_parallel_exec.load('UPGRADE_SEED',
794: 'begin '||ad_zd.apps_schema||'.ad_zd_seed.upgrade('''||x_table_name||'''); end;',
795: true);
796: ad_zd_parallel_exec.load('COLLECT_STATS',
797: 'begin '||ad_zd.apps_schema||'.fnd_stats.gather_table_stats('''||l_table_owner||''','''||x_table_name||''', 100, '||v_parallel||'); end;',
798: true);
799: commit;
800: log(c_module, 'PROCEDURE', 'end');
801: return;

Line 804: l_edition := ad_zd.get_edition;

800: log(c_module, 'PROCEDURE', 'end');
801: return;
802: end if;
803:
804: l_edition := ad_zd.get_edition;
805:
806: -- Table Must have EV
807: if ad_zd_table.ev_exists(l_table_owner, l_table_name) = 'N' then
808: error(c_module, 'Table must be upgraded for editioning first: '||x_table_name);

Line 807: if ad_zd_table.ev_exists(l_table_owner, l_table_name) = 'N' then

803:
804: l_edition := ad_zd.get_edition;
805:
806: -- Table Must have EV
807: if ad_zd_table.ev_exists(l_table_owner, l_table_name) = 'N' then
808: error(c_module, 'Table must be upgraded for editioning first: '||x_table_name);
809: end if;
810:
811: -- In Patch Edition, table must be new (not visible in Run Edition)

Line 812: if ad_zd.get_edition_type = 'PATCH' then

808: error(c_module, 'Table must be upgraded for editioning first: '||x_table_name);
809: end if;
810:
811: -- In Patch Edition, table must be new (not visible in Run Edition)
812: if ad_zd.get_edition_type = 'PATCH' then
813: begin
814: -- check if synonym exists in the run edition
815: select 'Y' into l_exists from dual
816: where exists

Line 818: where syn.owner = ad_zd.apps_schema

814: -- check if synonym exists in the run edition
815: select 'Y' into l_exists from dual
816: where exists
817: ( select syn.object_name from dba_objects_ae syn
818: where syn.owner = ad_zd.apps_schema
819: and syn.object_name = x_table_name
820: and syn.object_type = 'SYNONYM'
821: and syn.edition_name =
822: ( select max(ed.edition_name) from dba_objects_ae ed

Line 825: and ed.edition_name < ad_zd.get_edition ) );

821: and syn.edition_name =
822: ( select max(ed.edition_name) from dba_objects_ae ed
823: where ed.owner = syn.owner
824: and ed.object_name = syn.object_name
825: and ed.edition_name < ad_zd.get_edition ) );
826: error(c_module, 'Cannot upgrade existing table from Patch Edition: '
827: ||x_table_name);
828: exception
829: when no_data_found then

Line 853: if (ad_zd_table.is_seed(l_table_owner, l_table_name) = 'Y') then

849: end;
850:
851: -- Cannot re-upgrade existing seed data table,
852: -- but ok to upgrade new table with only ZD_EDITION_NAME column
853: if (ad_zd_table.is_seed(l_table_owner, l_table_name) = 'Y') then
854: -- Check if guard trigger exists
855: begin
856: select 'Y' into l_exists
857: from user_triggers

Line 858: where trigger_name = ad_zd_seed.eds_trigger(l_table_name)

854: -- Check if guard trigger exists
855: begin
856: select 'Y' into l_exists
857: from user_triggers
858: where trigger_name = ad_zd_seed.eds_trigger(l_table_name)
859: and table_owner = l_table_owner
860: and table_name = ad_zd_table.ev_view(l_table_name);
861:
862: log(c_module, 'WARNING', 'Cannot re-upgrade seed data table: '||x_table_name);

Line 860: and table_name = ad_zd_table.ev_view(l_table_name);

856: select 'Y' into l_exists
857: from user_triggers
858: where trigger_name = ad_zd_seed.eds_trigger(l_table_name)
859: and table_owner = l_table_owner
860: and table_name = ad_zd_table.ev_view(l_table_name);
861:
862: log(c_module, 'WARNING', 'Cannot re-upgrade seed data table: '||x_table_name);
863: return;
864: exception

Line 879: ad_zd_table.patch(l_table_owner, l_table_name);

875: log(c_module, 'EVENT', 'Upgrade Table: '||l_table_owner||'.'||l_table_name);
876:
877: alter_triggers(l_table_owner, l_table_name, 'DISABLE');
878: create_zd_column(l_table_owner, l_table_name, l_edition);
879: ad_zd_table.patch(l_table_owner, l_table_name);
880: fix_indexes(l_table_owner, l_table_name);
881: create_guard(l_table_owner, l_table_name, l_edition, l_save_body);
882: create_policy(l_table_owner, l_table_name, l_edition);
883: alter_triggers(l_table_owner, l_table_name, 'ENABLE');

Line 910: ** 6) Call ad_zd_table.upgrade to refresh EV and synonyms

906: ** 2) Drop the VPD Policy and Function
907: ** 3) Drop the FCET for data synchronization
908: ** 4) Drop the Trigger to Populate ZD_EDITION_NAME
909: ** 5) Mark the ZD_EDITION_NAME column unused
910: ** 6) Call ad_zd_table.upgrade to refresh EV and synonyms
911: ** 7) Drop SV
912: */
913: procedure DOWNGRADE(X_TABLE_NAME in varchar2)
914: is

Line 963: and object_name in (x_tab_name, ad_zd_table.ev_view(x_tab_name))

959:
960: cursor C_POLICY_CUR (x_tab_owner varchar2, x_tab_name varchar2) is
961: select object_owner, object_name, policy_name, function from dba_policies
962: where object_owner = x_tab_owner
963: and object_name in (x_tab_name, ad_zd_table.ev_view(x_tab_name))
964: and upper(policy_name) like '%ZD_SEED';
965:
966: begin
967: log(c_module, 'PROCEDURE', 'begin: '||x_table_name);

Line 969: l_editions_enabled := ad_zd.is_editions_enabled;

965:
966: begin
967: log(c_module, 'PROCEDURE', 'begin: '||x_table_name);
968:
969: l_editions_enabled := ad_zd.is_editions_enabled;
970: translate_synonym(c_module, x_table_name, false, l_table_owner, l_table_name);
971:
972: log(c_module, 'EVENT', 'Downgrade Table: '||l_table_owner||'.'||l_table_name);
973:

Line 976: if ad_zd_table.is_seed(l_table_owner, l_table_name) = 'Y' then

972: log(c_module, 'EVENT', 'Downgrade Table: '||l_table_owner||'.'||l_table_name);
973:
974: -- Cleanup data copies
975: if (l_editions_enabled = 'Y') then
976: if ad_zd_table.is_seed(l_table_owner, l_table_name) = 'Y' then
977: ad_zd_seed.cleanup(l_table_name);
978: end if;
979: end if;
980:

Line 977: ad_zd_seed.cleanup(l_table_name);

973:
974: -- Cleanup data copies
975: if (l_editions_enabled = 'Y') then
976: if ad_zd_table.is_seed(l_table_owner, l_table_name) = 'Y' then
977: ad_zd_seed.cleanup(l_table_name);
978: end if;
979: end if;
980:
981: -- Fix Constraints

Line 1041: l_stmt := 'drop function '|| '"'||ad_zd.apps_schema||'"."'||policyrec.function||'"';

1037: exception when no_policy_found then
1038: log(c_module, 'STATEMENT', 'Ignored: Policy not found');
1039: end;
1040: begin
1041: l_stmt := 'drop function '|| '"'||ad_zd.apps_schema||'"."'||policyrec.function||'"';
1042: exec(l_stmt, c_module, true);
1043: end;
1044: end loop;
1045:

Line 1048: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_fcet_name||'"';

1044: end loop;
1045:
1046: -- Drop EDS Sync Trigger (old style)
1047: l_fcet_name := replace(l_table_name, '_','-');
1048: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_fcet_name||'"';
1049: exec(l_stmt, c_module, true);
1050:
1051: -- Drop EDS Sync Trigger (new style)
1052: l_fcet_name := ad_zd_seed.eds_fcet(x_table_name);

Line 1052: l_fcet_name := ad_zd_seed.eds_fcet(x_table_name);

1048: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_fcet_name||'"';
1049: exec(l_stmt, c_module, true);
1050:
1051: -- Drop EDS Sync Trigger (new style)
1052: l_fcet_name := ad_zd_seed.eds_fcet(x_table_name);
1053: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_fcet_name||'"';
1054: exec(l_stmt, c_module, true);
1055:
1056: -- Drop EDS Guard Trigger (old style)

Line 1053: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_fcet_name||'"';

1049: exec(l_stmt, c_module, true);
1050:
1051: -- Drop EDS Sync Trigger (new style)
1052: l_fcet_name := ad_zd_seed.eds_fcet(x_table_name);
1053: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_fcet_name||'"';
1054: exec(l_stmt, c_module, true);
1055:
1056: -- Drop EDS Guard Trigger (old style)
1057: l_trig_name := lower(l_table_name);

Line 1058: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_trig_name||'"';

1054: exec(l_stmt, c_module, true);
1055:
1056: -- Drop EDS Guard Trigger (old style)
1057: l_trig_name := lower(l_table_name);
1058: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_trig_name||'"';
1059: exec(l_stmt, c_module, true);
1060:
1061: -- Drop EDS Guard Trigger (new style)
1062: l_trig_name := ad_zd_seed.eds_trigger(x_table_name);

Line 1062: l_trig_name := ad_zd_seed.eds_trigger(x_table_name);

1058: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_trig_name||'"';
1059: exec(l_stmt, c_module, true);
1060:
1061: -- Drop EDS Guard Trigger (new style)
1062: l_trig_name := ad_zd_seed.eds_trigger(x_table_name);
1063: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_trig_name||'"';
1064: exec(l_stmt, c_module, true);
1065:
1066: -- Mark EDS Striping Column unused

Line 1063: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_trig_name||'"';

1059: exec(l_stmt, c_module, true);
1060:
1061: -- Drop EDS Guard Trigger (new style)
1062: l_trig_name := ad_zd_seed.eds_trigger(x_table_name);
1063: l_stmt := 'drop trigger '|| '"'||ad_zd.apps_schema||'"."'||l_trig_name||'"';
1064: exec(l_stmt, c_module, true);
1065:
1066: -- Mark EDS Striping Column unused
1067: l_stmt := 'alter table "'||l_table_owner||'"."'||l_table_name||'" set unused (ZD_EDITION_NAME)';

Line 1072: ad_zd_table.patch(l_table_owner, l_table_name);

1068: exec(l_stmt, c_module, true);
1069:
1070: -- Regenerate editioning view
1071: if (l_editions_enabled = 'Y') then
1072: ad_zd_table.patch(l_table_owner, l_table_name);
1073: end if;
1074:
1075: -- Drop SV
1076: exec('drop view '||l_table_owner||'.'||substrb(x_table_name,1,29)||'$', c_module, true);

Line 1106: if ad_zd.get_edition_type <> 'PATCH' then

1102: begin
1103: log(c_module, 'PROCEDURE', 'begin: '||x_table_owner||'.'||x_table_name);
1104:
1105: -- If not in patch edition, then do nothing
1106: if ad_zd.get_edition_type <> 'PATCH' then
1107: log(c_module, 'PROCEDURE', 'end-noop');
1108: return;
1109: end if;
1110:

Line 1160: if ad_zd.get_edition_type(l_edition) <> 'PATCH' then

1156:
1157: begin
1158:
1159: -- If not in patch edition, then do nothing
1160: if ad_zd.get_edition_type(l_edition) <> 'PATCH' then
1161: return;
1162: end if;
1163:
1164: -- If prepare is repeated for the same table, then do nothing

Line 1178: open c_func_cur(ad_zd.apps_schema, ad_zd_seed.eds_function(x_table_name), l_edition);

1174:
1175: -- begin block to release lock on an exception
1176: begin
1177: -- If table is not yet prepared, then prepare it
1178: open c_func_cur(ad_zd.apps_schema, ad_zd_seed.eds_function(x_table_name), l_edition);
1179: fetch c_func_cur INTO l_text;
1180: if (c_func_cur%notfound) then
1181:
1182: log(c_module, 'EVENT', 'Prepare Table: '||l_table_owner||'.'||l_table_name);

Line 1193: exec('drop trigger '||ad_zd.apps_schema||'."'||ad_zd_seed.eds_fcet(l_table_name)||'"', c_module, TRUE);

1189: create_sync(l_table_owner, l_table_name, true);
1190: exception when others then
1191: log(c_module, 'EVENT', 'Prepare Failure, reversing actions');
1192: create_guard(l_table_owner, l_table_name, NULL, l_save_body);
1193: exec('drop trigger '||ad_zd.apps_schema||'."'||ad_zd_seed.eds_fcet(l_table_name)||'"', c_module, TRUE);
1194: alter_triggers(l_table_owner,l_table_name,'ENABLE');
1195: raise;
1196: end;
1197:

Line 1202: ad_zd_mview.patch(l_table_owner, l_table_name);

1198: create_policy(l_table_owner,l_table_name,l_edition);
1199: alter_triggers(l_table_owner,l_table_name,'ENABLE');
1200:
1201: -- Trigger regen for affected MVs
1202: ad_zd_mview.patch(l_table_owner, l_table_name);
1203: commit; /* we are only going to commit if everything was created sucessfully */
1204: end if;
1205: close c_func_cur;
1206:

Line 1245: ' from '||x_table_owner||'.'||ad_zd_table.ev_view(x_table_name)||

1241: -- Get current edition of seed data
1242: begin
1243: l_stmt :=
1244: 'select zd_edition_name'||
1245: ' from '||x_table_owner||'.'||ad_zd_table.ev_view(x_table_name)||
1246: ' where rownum=1';
1247: execute immediate l_stmt into l_seed_edition;
1248: exception
1249: when no_data_found then

Line 1300: and obj.object_name = ad_zd_seed.eds_function(col.table_name)

1296: ( select oracle_username from system.fnd_oracle_userid
1297: where read_only_flag in ('A','E') )
1298: and col.table_name not like '%#'
1299: and col.column_name = 'ZD_EDITION_NAME'
1300: and obj.object_name = ad_zd_seed.eds_function(col.table_name)
1301: and obj.object_type = 'FUNCTION'
1302: and obj.edition_name = sys_context('userenv', 'current_edition_name')
1303: and obj.edition_name <> 'ORA$BASE'
1304: and exists

Line 1313: if ad_zd.get_edition('PATCH') is not null then

1309:
1310: begin
1311: log(c_module, 'PROCEDURE', 'begin: '|| nvl(X_TABLE_NAME, 'NULL'));
1312:
1313: if ad_zd.get_edition('PATCH') is not null then
1314: error(c_module, 'Cannot cleanup while Patch Edition exists');
1315: end if;
1316:
1317: if ad_zd.get_edition_type(l_edition) <> 'RUN' then

Line 1317: if ad_zd.get_edition_type(l_edition) <> 'RUN' then

1313: if ad_zd.get_edition('PATCH') is not null then
1314: error(c_module, 'Cannot cleanup while Patch Edition exists');
1315: end if;
1316:
1317: if ad_zd.get_edition_type(l_edition) <> 'RUN' then
1318: error(c_module, 'Cleanup can only execute in the Run Edition');
1319: end if;
1320:
1321: if x_table_name is not null then

Line 1327: where s.owner = ad_zd.apps_schema

1323: begin
1324: select s.table_owner, s.table_name
1325: into l_table_owner, l_table_name
1326: from dba_synonyms s
1327: where s.owner = ad_zd.apps_schema
1328: and s.synonym_name = x_table_name;
1329: exception when no_data_found then
1330: log(c_module, 'STATEMENT', 'Ignored: Synonym does not exist: '
1331: ||x_table_name);

Line 1377: and obj.object_name = ad_zd_seed.eds_function(col.table_name)

1373: ( select oracle_username from system.fnd_oracle_userid
1374: where read_only_flag in ('A','E') )
1375: and col.table_name not like '%#'
1376: and col.column_name = 'ZD_EDITION_NAME'
1377: and obj.object_name = ad_zd_seed.eds_function(col.table_name)
1378: and obj.object_type = 'FUNCTION'
1379: and obj.edition_name > sys_context('userenv', 'current_edition_name')
1380: and exists
1381: ( select src.text from user_source_ae src

Line 1390: if ad_zd.get_edition_type <> 'RUN' then

1386:
1387: begin
1388: log(c_module, 'PROCEDURE', 'begin: no parameter(s)');
1389:
1390: if ad_zd.get_edition_type <> 'RUN' then
1391: error(c_module, 'Abort can only execute in the Run Edition');
1392: end if;
1393:
1394: for trec in c_prepared_seed_tables loop

Line 1396: l_stmt := 'begin ad_zd_seed.cleanup('''||trec.table_name||'''); end;';

1392: end if;
1393:
1394: for trec in c_prepared_seed_tables loop
1395: log(c_module, 'STATEMENT', 'Store cleanup action for seed data table: '||trec.table_name);
1396: l_stmt := 'begin ad_zd_seed.cleanup('''||trec.table_name||'''); end;';
1397: ad_zd.load_ddl('CLEANUP', l_stmt);
1398: end loop;
1399:
1400: log(c_module, 'PROCEDURE', 'end');

Line 1397: ad_zd.load_ddl('CLEANUP', l_stmt);

1393:
1394: for trec in c_prepared_seed_tables loop
1395: log(c_module, 'STATEMENT', 'Store cleanup action for seed data table: '||trec.table_name);
1396: l_stmt := 'begin ad_zd_seed.cleanup('''||trec.table_name||'''); end;';
1397: ad_zd.load_ddl('CLEANUP', l_stmt);
1398: end loop;
1399:
1400: log(c_module, 'PROCEDURE', 'end');
1401: end ABORT;

Line 1404: END AD_ZD_SEED;

1400: log(c_module, 'PROCEDURE', 'end');
1401: end ABORT;
1402:
1403:
1404: END AD_ZD_SEED;