set define '^' Rem Rem MODIFIED (MM/DD/YYYY) Rem sathikum 03/26/2009 - Created patch file for bug (8358834) Rem jkallman 04/10/2009 - Correct "set define" Rem hfarrell 05/28/2009 - Included changes for bug 8553100 declare p varchar2(32767) := null; begin wwv_flow_security.g_security_group_id := 10; p := 'declare'||chr(10)|| ' l_block_id number;'||chr(10)|| ' l_status varchar2(4) := null;'||chr(10)|| ' l_block_name varchar2(255);'||chr(10)|| ' l_block_source varchar(32676);'||chr(10)|| ' l_enhanced_query varchar2(32676);'||chr(10)|| ' l_original_query varchar2(32676);'||chr(10)|| 'begin'||chr(10)|| ''||chr(10)|| ' for c1 in ( select b.id block_id,'||chr(10)|| ' b.name block_name,'||chr(10)|| ' querydatasourcename block_so'; p:=p||'urce'||chr(10)|| ' from wwv_mig_forms p, '||chr(10)|| ' wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b '||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' ) LOOP'||chr(10)|| ' l_block_id '; p:=p||' := c1.block_id;'||chr(10)|| ' l_block_name := c1.block_name;'||chr(10)|| ' l_block_source := c1.block_source;'||chr(10)|| ' l_status := null;'||chr(10)|| ' l_original_query := ''select ''||chr(10);'||chr(10)|| ''||chr(10)|| ' IF (wwv_mig_frm_utilities.get_block_mapping('||chr(10)|| ' p_project_id => :MW_PROJ_ID,'||chr(10)|| ' p_security_group_id => :flow_security_group_id,'||chr(10)|| ' p_block_id => '; p:=p||'c1.block_id,'||chr(10)|| ' p_schema => :MW_SCHEMA) <> ''MASTERDETAIL'') then'||chr(10)|| ''||chr(10)|| ' if l_block_source is not null then '||chr(10)|| ' for c2 in ( select i.id, '||chr(10)|| ' nvl(i.columnname,i.name) column_name,'||chr(10)|| ' i.id block_item_id,'||chr(10)|| ' i.databaseitem'||chr(10)|| ' from wwv_mig_forms p, '||chr(10)|| ' '; p:=p||' wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b, '||chr(10)|| ' wwv_mig_frm_blk_items i'||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' '; p:=p||' and b.id = i.block_id'||chr(10)|| ' and (upper(i.databaseitem) = ''TRUE'' or '||chr(10)|| ' (i.databaseitem is null and (i.itemtype is null or i.itemtype <> ''Push Button'')))'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' and b.id = l_block_id'||chr(10)|| ' ) LOOP'||chr(10)|| ' l_original_query := l_origina'; p:=p||'l_query || l_status ||'' "''||trim(l_block_name)||''"."''|| trim(c2.column_name) || ''"''; '||chr(10)|| ' l_status := '',''||chr(10);'||chr(10)|| ' END LOOP;'||chr(10)|| ' -- code to check the Table name existing in in the schema, else use the upper case of that'||chr(10)|| ' if wwv_flow_builder.is_valid_table_or_view(:MW_SCHEMA, trim(l_block_source)) = ''U'' then '||chr(10)|| ' l_block_source :'; p:=p||'= upper(l_block_source);'||chr(10)|| ' end if;'||chr(10)|| ' l_original_query := l_original_query || chr(10) || '' from "'' || trim(l_block_source) ||''" "''|| trim(l_block_name) || ''"'';'||chr(10)|| ''||chr(10)|| ' l_enhanced_query := wwv_mig_frm_utilities.trigger_parse_block_sql(:MW_PROJ_ID, l_block_id, :MW_SCHEMA);'||chr(10)|| ' '||chr(10)|| ' UPDATE wwv_mig_frm_blocks '||chr(10)|| ' SET original_query = l_origi'; p:=p||'nal_query, '||chr(10)|| ' enhanced_query = l_enhanced_query, '||chr(10)|| ' use_query = decode(l_enhanced_query,null,''ORIGINAL'',''ENHANCED''),'||chr(10)|| ' complete = decode(l_enhanced_query,null,''N'',''Y''),'||chr(10)|| ' notes = decode(l_enhanced_query,null,null,wwv_flow_lang.system_message(''F4400_ENHANCED_QRY_NOTE''))'||chr(10)|| ' WHERE id = l_block_id;'||chr(10)|| ''||chr(10)|| ''||chr(10)|| ' '; p:=p||' -- Set COMPLETE to ''Y'' for block & associated items using Enhanced Query'||chr(10)|| ' if (l_enhanced_query is not null) then'||chr(10)|| ' -- Fix for bug 7630444 - Only update POST-QUERY trigger'||chr(10)|| ' --UPDATE wwv_mig_frm_blk_triggers'||chr(10)|| ' --SET complete = ''Y'''||chr(10)|| ' --WHERE block_id = l_block_id;'||chr(10)|| ''||chr(10)|| ' UPDATE wwv_mi'; p:=p||'g_frm_blk_triggers'||chr(10)|| ' SET notes = wwv_flow_lang.system_message(''F4400_ENHANCED_QRY_TRIG_NOTE''),'||chr(10)|| ' complete = ''Y'''||chr(10)|| ' WHERE block_id = l_block_id'||chr(10)|| ' AND name = ''POST-QUERY'';'||chr(10)|| ' --AND complete = ''Y'';'||chr(10)|| ''||chr(10)|| ' FOR c3 IN (select i.id item_id'||chr(10)|| ' from wwv_mig_fo'; p:=p||'rms p, wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, wwv_mig_frm_rev_formmodules rf, '||chr(10)|| ' wwv_mig_frm_blocks b, wwv_mig_frm_rev_blocks rb, '||chr(10)|| ' wwv_mig_frm_blk_items i, wwv_mig_frm_rev_blk_items ri'||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and '; p:=p||' m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and f.id = rf.formmodule_id'||chr(10)|| ' and b.id = rb.block_id'||chr(10)|| ' and b.id = i.block_id'||chr(10)|| ' and b.id = l_block_id'||chr(10)|| ' and i.id = ri.item_id'||chr(10)|| ' ) LOOP'||chr(10)|| ' '; p:=p||' '||chr(10)|| ' UPDATE wwv_mig_frm_blk_items'||chr(10)|| ' SET complete = ''Y'''||chr(10)|| ' WHERE id = c3.item_id;'||chr(10)|| ' '||chr(10)|| ' -- Fix for bug 76030444 - do not update Item-level Triggers'||chr(10)|| ' --UPDATE wwv_mig_frm_blk_item_triggers'||chr(10)|| ' --SET complete = ''Y'''||chr(10)|| ' --WHERE item_id'; p:=p||' = c3.item_id;'||chr(10)|| ' '||chr(10)|| ' END LOOP;'||chr(10)|| ' END IF;'||chr(10)|| ''||chr(10)|| ' commit;'||chr(10)|| ' END IF;'||chr(10)|| ''||chr(10)|| ' END IF; '||chr(10)|| ''||chr(10)|| ' END LOOP;'||chr(10)|| 'END;'; update wwv_flow_step_processing set process_sql_clob = p where flow_id between 4400 and 4409 and flow_step_id >= 18 and flow_step_id < 18 + 1 and id >= 72937719491257872 and id < 72937719491257872 + 1; p:='declare'||chr(10)|| ' l_block_id number;'||chr(10)|| ' l_enhanced_query varchar2(32676);'||chr(10)|| ' l_original_query varchar2(32676);'||chr(10)|| ' l_status varchar2(4) := null;'||chr(10)|| ' l_block_name varchar2(255);'||chr(10)|| ' l_block_source varchar(32676);'||chr(10)|| 'begin'||chr(10)|| ''||chr(10)|| ' for c1 in (select b.id block_id,'||chr(10)|| ' b.name block_name,'||chr(10)|| ' querydatasourcename block_source'||chr(10)|| ' '; p:=p||' from wwv_mig_forms p, '||chr(10)|| ' wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b '||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' ) LOOP'||chr(10)|| ' l_block_id := c1.block_id;'||chr(10)|| ' '; p:=p||' l_block_name := c1.block_name;'||chr(10)|| ' l_block_source := c1.block_source;'||chr(10)|| ' l_status := null;'||chr(10)|| ' l_original_query := ''select ''||chr(10);'||chr(10)|| ' '||chr(10)|| ' IF (wwv_mig_frm_utilities.get_block_mapping('||chr(10)|| ' p_project_id => :MW_PROJ_ID,'||chr(10)|| ' p_security_group_id => :flow_security_group_id,'||chr(10)|| ' p_block_id => c1.block_id,'||chr(10)|| ' '; p:=p||' p_schema => :MW_SCHEMA) <> ''MASTERDETAIL'') then'||chr(10)|| ''||chr(10)|| ' if (l_block_source is not null) then '||chr(10)|| ' for c2 in (select i.id, '||chr(10)|| ' nvl(i.columnname,i.name) column_name,'||chr(10)|| ' i.id block_item_id,'||chr(10)|| ' i.databaseitem'||chr(10)|| ' from wwv_mig_forms p, '||chr(10)|| ' '; p:=p||' wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b, '||chr(10)|| ' wwv_mig_frm_blk_items i'||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and b.i'; p:=p||'d = i.block_id'||chr(10)|| ' and (upper(i.databaseitem) = ''TRUE'' or '||chr(10)|| ' (i.databaseitem is null and (i.itemtype is null or i.itemtype <> ''Push Button'')))'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' and b.id = l_block_id'||chr(10)|| ' ) LOOP'||chr(10)|| ' l_original_query := l_original_query || l_status ||'' "''||t'; p:=p||'rim(l_block_name)||''"."''|| trim(c2.column_name) || ''"''; '||chr(10)|| ' l_status := '',''||chr(10);'||chr(10)|| ' END LOOP;'||chr(10)|| '-- code to check the Table name existing in in the schema'||chr(10)|| ' if wwv_flow_builder.is_valid_table_or_view(:MW_SCHEMA, trim(l_block_source)) = ''U'' then '||chr(10)|| ' l_block_source := upper(l_block_source);'||chr(10)|| ' end if;'||chr(10)|| '-- end of the code -- '||chr(10)|| ''||chr(10)|| ''; p:=p||' l_original_query := l_original_query || chr(10) || '' from "'' || trim(l_block_source) ||''" "''|| trim(l_block_name) || ''"'';'||chr(10)|| ''||chr(10)|| ' l_enhanced_query := wwv_mig_frm_utilities.trigger_parse_block_sql(:MW_PROJ_ID, l_block_id, :MW_SCHEMA);'||chr(10)|| ' '||chr(10)|| ' UPDATE wwv_mig_frm_blocks '||chr(10)|| ' SET original_query = l_original_query, '||chr(10)|| ' enha'; p:=p||'nced_query = l_enhanced_query, '||chr(10)|| ' use_query = decode(l_enhanced_query,null,''ORIGINAL'',''ENHANCED''),'||chr(10)|| ' complete = decode(l_enhanced_query,null,''N'',''Y''),'||chr(10)|| ' notes = decode(l_enhanced_query,null,null,wwv_flow_lang.system_message(''F4400_ENHANCED_QRY_NOTE''))'||chr(10)|| ' WHERE id = l_block_id;'||chr(10)|| ''||chr(10)|| ' -- Set COMPLETE to ''Y'' for b'; p:=p||'lock & associated items using Enhanced Query'||chr(10)|| ' if (l_enhanced_query is not null) then'||chr(10)|| ' -- Fix for bug 7630444 - update only POST-QUERY trigger'||chr(10)|| ' --UPDATE wwv_mig_frm_blk_triggers'||chr(10)|| ' --SET complete = ''Y'''||chr(10)|| ' --WHERE block_id = l_block_id;'||chr(10)|| ''||chr(10)|| ' UPDATE wwv_mig_frm_blk_triggers'||chr(10)|| ' S'; p:=p||'ET notes = wwv_flow_lang.system_message(''F4400_ENHANCED_QRY_TRIG_NOTE''),'||chr(10)|| ' complete = ''Y'''||chr(10)|| ' WHERE block_id = l_block_id'||chr(10)|| ' AND name = ''POST-QUERY'';'||chr(10)|| ' --AND complete = ''Y'';'||chr(10)|| ''||chr(10)|| ' FOR c3 IN (select i.id item_id'||chr(10)|| ' from wwv_mig_forms p, wwv_mig_frm_modules m, '||chr(10)|| ' '; p:=p||' wwv_mig_frm_formmodules f, wwv_mig_frm_rev_formmodules rf, '||chr(10)|| ' wwv_mig_frm_blocks b, wwv_mig_frm_rev_blocks rb, '||chr(10)|| ' wwv_mig_frm_blk_items i, wwv_mig_frm_rev_blk_items ri'||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' '; p:=p||' and f.id = b.formmodule_id'||chr(10)|| ' and f.id = rf.formmodule_id'||chr(10)|| ' and b.id = rb.block_id'||chr(10)|| ' and b.id = i.block_id'||chr(10)|| ' and b.id = l_block_id'||chr(10)|| ' and i.id = ri.item_id'||chr(10)|| ' ) LOOP'||chr(10)|| ' '||chr(10)|| ' UPDATE wwv_'; p:=p||'mig_frm_blk_items'||chr(10)|| ' SET complete = ''Y'''||chr(10)|| ' WHERE id = c3.item_id;'||chr(10)|| ' '||chr(10)|| ' -- Fix for bug 7630444 - Only POST-QUERY block trigger should be updated now'||chr(10)|| ' --UPDATE wwv_mig_frm_blk_item_triggers'||chr(10)|| ' --SET complete = ''Y'''||chr(10)|| ' --WHERE item_id = c3.item_id;'||chr(10)|| ' '; p:=p||''||chr(10)|| ' END LOOP;'||chr(10)|| ' END IF;'||chr(10)|| ''||chr(10)|| ' commit;'||chr(10)|| ' end if;'||chr(10)|| ''||chr(10)|| ' END IF; '||chr(10)|| 'end loop;'||chr(10)|| 'end ;'; update wwv_flow_step_processing set process_sql_clob = p where flow_id between 4400 and 4409 and flow_step_id >= 52 and flow_step_id < 52 + 1 and id >= 73142117216118166 and id < 73142117216118166 + 1; p:='declare'||chr(10)|| ' l_block_id number ;'||chr(10)|| ' l_enhanced_query varchar2(32676);'||chr(10)|| ' l_original_query varchar2(32676);'||chr(10)|| ' l_status varchar2(4) := null;'||chr(10)|| ' l_block_name varchar2(255);'||chr(10)|| ' l_block_source varchar(32676);'||chr(10)|| 'begin'||chr(10)|| ''||chr(10)|| ' for c1 in (select b.id block_id,'||chr(10)|| ' b.name block_name,'||chr(10)|| ' querydatasourcename block_source'||chr(10)|| ' from wwv_mig_for'; p:=p||'ms p, '||chr(10)|| ' wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b '||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' ) loop'||chr(10)|| ' l_block_id := c1.block_id;'||chr(10)|| ' l_block_name :='; p:=p||' c1.block_name;'||chr(10)|| ' l_block_source := c1.block_source;'||chr(10)|| ' l_status := null;'||chr(10)|| ' l_original_query := ''select ''||chr(10);'||chr(10)|| ''||chr(10)|| ' if (wwv_mig_frm_utilities.get_block_mapping('||chr(10)|| ' p_project_id => :MW_PROJ_ID,'||chr(10)|| ' p_security_group_id => :flow_security_group_id,'||chr(10)|| ' p_block_id => c1.block_id,'||chr(10)|| ' p_schema =>'; p:=p||' :MW_SCHEMA) <> ''MASTERDETAIL'') then'||chr(10)|| ' '||chr(10)|| ' if l_block_source is not null then '||chr(10)|| ' for c2 in ( select i.id, '||chr(10)|| ' nvl(i.columnname,i.name) column_name,'||chr(10)|| ' i.id block_item_id,'||chr(10)|| ' i.databaseitem'||chr(10)|| ' from wwv_mig_forms p, '||chr(10)|| ' wwv_mig_frm_modules'; p:=p||' m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b, '||chr(10)|| ' wwv_mig_frm_blk_items i'||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and b.id = i.block_i'; p:=p||'d'||chr(10)|| ' and (upper(i.databaseitem) = ''TRUE'' or '||chr(10)|| ' (i.databaseitem is null and (i.itemtype is null or i.itemtype <> ''Push Button'')))'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' and b.id = l_block_id'||chr(10)|| ' ) loop'||chr(10)|| ' l_original_query := l_original_query || l_status ||'' "''||trim(l_block_nam'; p:=p||'e)||''"."''|| trim(c2.column_name) || ''"''; '||chr(10)|| ' l_status := '',''||chr(10);'||chr(10)|| ' end loop;'||chr(10)|| ' -- code to check the Table name existing in in the schema, else use the upper case of that'||chr(10)|| ' if wwv_flow_builder.is_valid_table_or_view(:MW_SCHEMA, trim(l_block_source)) = ''U'' then '||chr(10)|| ' l_block_source := upper(l_block_source);'||chr(10)|| ' end if;'||chr(10)|| ' '; p:=p||' l_original_query := l_original_query || chr(10) || '' from "'' || trim(l_block_source) ||''" "''|| trim(l_block_name) || ''"'' ;'||chr(10)|| ''||chr(10)|| ' l_enhanced_query := wwv_mig_frm_utilities.trigger_parse_block_sql(:MW_PROJ_ID, l_block_id, :MW_SCHEMA);'||chr(10)|| ''||chr(10)|| ' update wwv_mig_frm_blocks '||chr(10)|| ' set original_query = l_original_query, '||chr(10)|| ' enhanced_query = '; p:=p||'l_enhanced_query, '||chr(10)|| ' use_query = decode(l_enhanced_query,null,''ORIGINAL'',''ENHANCED'')'||chr(10)|| ' where id = l_block_id;'||chr(10)|| ''||chr(10)|| ' commit;'||chr(10)|| ' end if;'||chr(10)|| ''||chr(10)|| ' END IF; '||chr(10)|| 'end loop;'||chr(10)|| 'end;'; update wwv_flow_step_processing set process_sql_clob = p where flow_id between 4400 and 4409 and flow_step_id >= 106 and flow_step_id < 106 + 1 and id >= 78595417775678795 and id < 78595417775678795 + 1; update wwv_flow_step_items set item_default = 'nvl(:P77_ENHANCED_QUERY,wwv_mig_frm_utilities.trigger_parse_block_sql(:MW_PROJ_ID, :P77_ID,:MW_SCHEMA));' where flow_id between 4400 and 4409 and flow_step_id >= 77 and flow_step_id < 77 + 1 and id >= 71623520929952255 and id < 71623520929952255 + 1; p:= 'declare'||chr(10)|| ' l_status varchar2(4) := null;'||chr(10)|| ' l_qry varchar2(32767) := null;'||chr(10)|| ' l_block_source varchar2(32767) := :P77_QUERYDATASOURCENAME ;'||chr(10)|| 'begin'||chr(10)|| ' if :P77_QUERYDATASOURCENAME is not null then'||chr(10)|| ' l_qry := ''select '' || chr(10);'||chr(10)|| ' for c1 in (select i.id, '||chr(10)|| ' nvl(i.columnname,i.name) column_name,'||chr(10)|| ' i.id block_item_id,'||chr(10)|| ' decode(i.databaseitem, ''true'', t.y,'||chr(10)|| ' ''false'', t.n,'||chr(10)|| ' nvl2(i.columnname,t.y,t.n)) databaseitem'||chr(10)|| ' from wwv_mig_forms p, '||chr(10)|| ' wwv_mig_frm_modules m, '||chr(10)|| ' wwv_mig_frm_formmodules f, '||chr(10)|| ' wwv_mig_frm_blocks b, '||chr(10)|| ' wwv_mig_frm_blk_items i,'||chr(10)|| ' (select wwv_flow_lang.system_message(''APEXIR_YES'') y,'||chr(10)|| ' wwv_flow_lang.system_message(''APEXIR_NO'') n '||chr(10)|| ' from dual) t'||chr(10)|| ' where p.id = m.file_id'||chr(10)|| ' and m.id = f.module_id'||chr(10)|| ' and f.id = b.formmodule_id'||chr(10)|| ' and b.id = i.block_id'||chr(10)|| ' and (upper(i.databaseitem) = ''TRUE'' or '||chr(10)|| ' (i.databaseitem is null and (i.itemtype is null or i.itemtype <> ''Push Button'')))'||chr(10)|| ' and p.project_id = :MW_PROJ_ID'||chr(10)|| ' and b.id = :P77_ID'||chr(10)|| ' ) loop'||chr(10)|| ' l_qry := l_qry || l_status ||'' "''||trim(:P77_NAME)||''"."''|| trim(c1.column_name) || ''"'' ; '||chr(10)|| ' l_status := '',''||chr(10);'||chr(10)|| ' end loop;'||chr(10)|| ' -- code to check the Table name existing in in the schema, else use the upper case of that'||chr(10)|| ' if wwv_flow_builder.is_valid_table_or_view(:MW_SCHEMA, trim(l_block_source)) = ''U'' then '||chr(10)|| ' l_block_source := upper(l_block_source);'||chr(10)|| ' end if; '||chr(10)|| ' l_qry := l_qry || chr(10) || '' from "'' || trim(l_block_source) ||''" "''|| trim(:P77_NAME) || ''"'';'||chr(10)|| ' end if;'||chr(10)|| ' '||chr(10)|| ' return l_qry;'||chr(10)|| 'end;'; update wwv_flow_step_items set source = p where flow_id between 4400 and 4409 and flow_step_id >= 77 and flow_step_id < 77 + 1 and id >= 257125228326289166 and id < 257125228326289166 + 1; commit; end; / set define '^'