1669: -- for deleting duplicate actions
1670: --
1671: cursor del_cursor is
1672: select patch_run_bug_id, common_action_id, file_id, rowid row_id
1673: from ad_patch_hist_temp
1674: where (patch_run_bug_id, common_action_id, file_id) in
1675: (select patch_run_bug_id, common_action_id, file_id
1676: from AD_PATCH_HIST_TEMP
1677: group by patch_run_bug_id, common_action_id, file_id
1672: select patch_run_bug_id, common_action_id, file_id, rowid row_id
1673: from ad_patch_hist_temp
1674: where (patch_run_bug_id, common_action_id, file_id) in
1675: (select patch_run_bug_id, common_action_id, file_id
1676: from AD_PATCH_HIST_TEMP
1677: group by patch_run_bug_id, common_action_id, file_id
1678: having count(*) > 1)
1679: order by 1, 2, 3;
1680: prb_id number;
1687: begin
1688:
1689: -- bug 6343734 diverma 16 August 2007
1690: --
1691: -- update AD_PATCH_HIST_TEMP.TRACKABLE_ENTITY_ABBR with
1692: -- AD_PATCH_HIST_TEMP.BUG_APP_SHORT_NAME if it is null.
1693: --
1694:
1695: update AD_PATCH_HIST_TEMP
1688:
1689: -- bug 6343734 diverma 16 August 2007
1690: --
1691: -- update AD_PATCH_HIST_TEMP.TRACKABLE_ENTITY_ABBR with
1692: -- AD_PATCH_HIST_TEMP.BUG_APP_SHORT_NAME if it is null.
1693: --
1694:
1695: update AD_PATCH_HIST_TEMP
1696: set TRACKABLE_ENTITY_NAME = BUG_APP_SHORT_NAME
1691: -- update AD_PATCH_HIST_TEMP.TRACKABLE_ENTITY_ABBR with
1692: -- AD_PATCH_HIST_TEMP.BUG_APP_SHORT_NAME if it is null.
1693: --
1694:
1695: update AD_PATCH_HIST_TEMP
1696: set TRACKABLE_ENTITY_NAME = BUG_APP_SHORT_NAME
1697: where TRACKABLE_ENTITY_NAME is null;
1698:
1699: update AD_PATCH_HIST_TEMP
1695: update AD_PATCH_HIST_TEMP
1696: set TRACKABLE_ENTITY_NAME = BUG_APP_SHORT_NAME
1697: where TRACKABLE_ENTITY_NAME is null;
1698:
1699: update AD_PATCH_HIST_TEMP
1700: set LANGUAGE = 'US'
1701: where LANGUAGE is null;
1702:
1703: --
1722: -- bug 6332450 diverma Thu Aug 9 06:25:06 PDT 2007
1723: -- bug 5615204 diverma Tuesday, August 07, 2007
1724: TRACKABLE_ENTITY_NAME, BASELINE_NAME, GENERIC_PATCH, LANGUAGE
1725: from
1726: AD_PATCH_HIST_TEMP where BUG_NUMBER is not null) tmp
1727: where
1728: not exists (
1729: select
1730: 'x'
1742: -- ----------------------------------------------------------
1743: -- Changed the condition in the subquery .
1744: -- Earlier condition " b.generic_patch=y " was returning multiple
1745: -- rows for a single row return subquery.
1746: -- Using the generic_patch column present in the ad_patch_hist_temp
1747: -- for refining the search condition in subquery
1748: -- and to return a single row
1749: -- -----------------------------------------------------------
1750: --
1749: -- -----------------------------------------------------------
1750: --
1751: -- Get the Bug_id into the Staging Table
1752: --
1753: update AD_PATCH_HIST_TEMP t
1754: set t.bug_id = (
1755: select
1756: b.bug_id from ad_bugs b
1757: where
1785: distinct patch_run_id,bug_id,
1786: orig_bug_number, bug_app_short_name,
1787: success_flag, applied_flag, reason_not_applied
1788: from
1789: AD_PATCH_HIST_TEMP ) t
1790: where
1791: not exists (
1792: select
1793: 'x'
1802: bugs_processed := l_bugs_processed;
1803: --
1804: -- Get the patch_run_bug_id into staging table
1805: --
1806: update AD_PATCH_HIST_TEMP t
1807: set PATCH_RUN_BUG_ID
1808: =(select
1809: b.PATCH_RUN_BUG_ID
1810: from
1834: t.file_apps_short_name ,
1835: t.file_subdir ,
1836: t.filename
1837: from
1838: AD_PATCH_HIST_TEMP t
1839: ) temp
1840: where not exists (
1841: select
1842: 'x' from ad_files fl
1848: and temp.filename is not null;
1849: --
1850: -- Get the file_id into the staging table
1851: --
1852: update AD_PATCH_HIST_TEMP t
1853: set t.file_id =
1854: (select f.file_id
1855: from ad_files f
1856: where
1875: t.ldr_app_short_name ,
1876: t.ldr_subdir ,
1877: t.ldr_filename
1878: from
1879: AD_PATCH_HIST_TEMP t
1880: ) temp
1881: where not exists (
1882: select
1883: 'x' from ad_files fl
1889: and temp.ldr_filename is not null;
1890: --
1891: -- Get the Loader file_id into the staging table
1892: --
1893: update AD_PATCH_HIST_TEMP t
1894: set t.loader_data_file_id =
1895: (select f.file_id
1896: from ad_files f
1897: where
1925: t.dest_apps_short_name ,
1926: t.dest_subdir ,
1927: t.dest_filename
1928: from
1929: AD_PATCH_HIST_TEMP t
1930: where t.dest_apps_short_name is not null
1931: and t.dest_subdir is not null
1932: and t.dest_filename is not null
1933: ) temp
1941:
1942: --
1943: -- Get the Destination file_id into the staging table
1944: --
1945: update AD_PATCH_HIST_TEMP t
1946: set t.dest_file_id =
1947: (select /*+ INDEX(F AD_FILES_U2) */ f.file_id
1948: from ad_files f
1949: where f.app_short_name = t.dest_apps_short_name
1986: t.PATCH_VERSION_SEGMENT8 vs8,
1987: t.PATCH_VERSION_SEGMENT9 vs9,
1988: t.PATCH_VERSION_SEGMENT10 vs10
1989: from
1990: AD_PATCH_HIST_TEMP t
1991: where
1992: t.PATCH_FILE_VERS is not null
1993: ) temp
1994: where not exists (
2032: t.ONSITE_VERSION_SEGMENT8 vs8,
2033: t.ONSITE_VERSION_SEGMENT9 vs9,
2034: t.ONSITE_VERSION_SEGMENT10 vs10
2035: from
2036: AD_PATCH_HIST_TEMP t
2037: where
2038: t.ONSITE_FILE_VERS is not NULL
2039: ) temp
2040: where not exists (
2079: t.DB_VERSION_SEGMENT8 vs8 ,
2080: t.DB_VERSION_SEGMENT9 vs9 ,
2081: t.DB_VERSION_SEGMENT10 vs10
2082: from
2083: AD_PATCH_HIST_TEMP t
2084: where
2085: t.DB_FILE_VERS is not null
2086: ) tmp
2087: where not exists (
2101: -- Process the PatchFile Versions
2102: --
2103: -- Get the file_version_id into the staging table
2104: --
2105: update AD_PATCH_HIST_TEMP t
2106: set t.PATCH_FILE_VERS_ID =
2107: (select
2108: fv.file_version_id
2109: from
2121: --
2122: -- Get the file_version_id into the staging table
2123: --
2124: --
2125: update AD_PATCH_HIST_TEMP t
2126: set t.ONSITE_FILE_VERS_ID =
2127: (select
2128: fv.file_version_id
2129: from
2140: -- Process the Db FileVersions
2141: --
2142: -- Get the file_version_id into the staging table
2143: --
2144: update AD_PATCH_HIST_TEMP t
2145: set t.DB_FILE_VERS_ID =
2146: (select
2147: fv.file_version_id
2148: from
2181: action_arguments, checkfile_args, checkobj , checkobj_un ,
2182: checkobj_pw, action_modifier, action_tierlist ,
2183: action_lang_code, concat_attribs, loader_data_file_id
2184: from
2185: AD_PATCH_HIST_TEMP )t
2186: where not exists (
2187: select
2188: 'x'
2189: FROM
2193: and t.concat_attribs is not null;
2194: --
2195: -- Get the COMMON_ACTION_ID into the staging table
2196: --
2197: update AD_PATCH_HIST_TEMP t
2198: set t.COMMON_ACTION_ID =
2199: (select
2200: PCA.COMMON_ACTION_ID
2201: from
2234: prb_id := c1.patch_run_bug_id;
2235: ca_id := c1.common_action_id;
2236: f_id := c1.file_id;
2237:
2238: statement := 'delete from ad_patch_hist_temp'||
2239: ' where patch_run_bug_id = '||c1.patch_run_bug_id||
2240: ' and common_action_id = '||c1.common_action_id||
2241: ' and file_id = '||c1.file_id||
2242: ' and rowid <> '''||c1.row_id||'''';
2273: t.onsite_file_vers_id,
2274: t.db_file_vers_id,
2275: t.action_executed_flag,
2276: t.dest_file_id, t.file_type_flag,
2277: SYSDATE, SYSDATE, 5, 5 from AD_PATCH_HIST_TEMP t
2278: where not exists
2279: (select
2280: 'x'
2281: from
2318: t.onsite_file_vers_id,
2319: t.db_file_vers_id,
2320: t.action_executed_flag,
2321: t.dest_file_id, t.file_type_flag,
2322: SYSDATE, SYSDATE, 5, 5 from AD_PATCH_HIST_TEMP t
2323: where not exists
2324: (select
2325: 'x'
2326: from
2497: begin
2498: --
2499: --
2500: execute immediate 'truncate table '|| p_un_fnd ||'.ad_snapshot_files_temp';
2501: execute immediate 'truncate table '|| p_un_fnd ||'.ad_patch_hist_temp';
2502: --
2503: --
2504: if (p_iteration = 1) then
2505: execute immediate 'truncate table '|| p_un_fnd ||'.ad_check_file_temp';
2576: --
2577: commit;
2578: --
2579: --
2580: insert into ad_patch_hist_temp
2581: (
2582: file_id, patch_file_vers_id , onsite_file_vers_id,
2583: bug_id, patch_run_bug_id ,
2584: db_file_vers_id, applied_flag,common_action_id,
2618: --
2619: commit;
2620: --
2621: --
2622: update ad_patch_hist_temp tmp set
2623: (tmp.PATCH_VERSION_SEGMENT1, tmp.PATCH_VERSION_SEGMENT2,
2624: tmp.PATCH_VERSION_SEGMENT3, tmp.PATCH_VERSION_SEGMENT4,
2625: tmp.PATCH_VERSION_SEGMENT5, tmp.PATCH_VERSION_SEGMENT6,
2626: tmp.PATCH_VERSION_SEGMENT7, tmp.PATCH_VERSION_SEGMENT8,
2639: v.file_version_id = tmp.PATCH_FILE_VERS_ID),
2640: tmp.concat_attribs=null;
2641: --
2642: --
2643: update ad_patch_hist_temp tmp set
2644: tmp.PATCH_VERSION_SEGMENT1=0, tmp.PATCH_VERSION_SEGMENT2=0,
2645: tmp.PATCH_VERSION_SEGMENT3=0, tmp.PATCH_VERSION_SEGMENT4=0,
2646: tmp.PATCH_VERSION_SEGMENT5=0, tmp.PATCH_VERSION_SEGMENT6=0,
2647: tmp.PATCH_VERSION_SEGMENT7=0, tmp.PATCH_VERSION_SEGMENT8=0,
2680: PATCH_VERSION_SEGMENT9 desc, PATCH_VERSION_SEGMENT10 desc,
2681: PATCH_TRANS_LEVEL desc NULLS LAST
2682: ) rnk
2683: from
2684: ad_patch_hist_temp) where rnk=1' using v_global_snapshot_id;
2685: --
2686: --
2687: commit;
2688: --
2689: --
2690: if (p_iteration = 1) then
2691: FND_STATS.Gather_Table_Stats(p_un_fnd, 'AD_SNAPSHOT_FILES_TEMP');
2692: FND_STATS.Gather_Table_Stats(p_un_fnd, 'AD_CHECK_FILE_TEMP');
2693: FND_STATS.Gather_Table_Stats(p_un_fnd, 'AD_PATCH_HIST_TEMP');
2694: end if;
2695: --
2696: --
2697: end populate_snapshot_files_temp;
2730: --
2731: if (p_iteration = 1) then
2732: --
2733: --
2734: execute immediate 'truncate table '||p_un_fnd||'.ad_patch_hist_temp';
2735: --
2736: --
2737: insert into ad_patch_hist_temp
2738: (patch_run_id)
2733: --
2734: execute immediate 'truncate table '||p_un_fnd||'.ad_patch_hist_temp';
2735: --
2736: --
2737: insert into ad_patch_hist_temp
2738: (patch_run_id)
2739: select
2740: snapshot_id
2741: from
2779: ad_snapshot_bugfixes
2780: where
2781: bugfix_id >= p_min_bug_id and
2782: bugfix_id < p_max_bug_id and
2783: snapshot_id in (select patch_run_id from ad_patch_hist_temp)
2784: group by
2785: bugfix_id
2786: having
2787: count(distinct decode(success_flag, 'Y', 2, 1)) = 1);
2810: ad_snapshot_bugfixes
2811: where
2812: bugfix_id >= p_min_bug_id and
2813: bugfix_id < p_max_bug_id and
2814: snapshot_id in (select patch_run_id from ad_patch_hist_temp)
2815: group by bugfix_id
2816: having count(distinct decode(success_flag, 'Y', 2, 1)) >1);
2817: --
2818: --
2857: --
2858: if (p_iteration = 1) then
2859: FND_STATS.Gather_Table_Stats(p_un_fnd, 'AD_SNAPSHOT_FILES_TEMP');
2860: FND_STATS.Gather_Table_Stats(p_un_fnd, 'AD_CHECK_FILE_TEMP');
2861: FND_STATS.Gather_Table_Stats(p_un_fnd, 'AD_PATCH_HIST_TEMP');
2862: end if;
2863: --
2864: --
2865: end populate_snapshot_bugs_temp;