[Home] [Help]
70: -- prior use. For that, first commit.
71:
72: commit;
73:
74: fnd_stats.gather_table_stats(G_UN_FND, 'ad_patch_hist_snaps_temp');
75:
76: if G_DEBUG then
77: put_line('Inserting candidate bugs into temp table');
78: end if;
78: end if;
79:
80: --bug3537094. The following insert should be used instead
81: --Also removed 2 delete stmt which deletes unknown and duplicate
82: --rows from ad_patch_hist_snaps_temp
83:
84: insert into ad_patch_hist_snaps_temp (action_code, bug_id)
85: select distinct L_BUGSTAT_EXPL_ACT_CD, prb.bug_id
86: from ad_patch_run_bugs prb, ad_patch_hist_snaps_temp t
80: --bug3537094. The following insert should be used instead
81: --Also removed 2 delete stmt which deletes unknown and duplicate
82: --rows from ad_patch_hist_snaps_temp
83:
84: insert into ad_patch_hist_snaps_temp (action_code, bug_id)
85: select distinct L_BUGSTAT_EXPL_ACT_CD, prb.bug_id
86: from ad_patch_run_bugs prb, ad_patch_hist_snaps_temp t
87: where prb.patch_run_id = t.patch_run_id
88: and t.action_code = p_action_code
82: --rows from ad_patch_hist_snaps_temp
83:
84: insert into ad_patch_hist_snaps_temp (action_code, bug_id)
85: select distinct L_BUGSTAT_EXPL_ACT_CD, prb.bug_id
86: from ad_patch_run_bugs prb, ad_patch_hist_snaps_temp t
87: where prb.patch_run_id = t.patch_run_id
88: and t.action_code = p_action_code
89: and (prb.applied_flag = 'Y' or prb.reason_not_applied = L_ADPBNAAS);
90:
100: if G_DEBUG then
101: put_line('Gathering stats');
102: end if;
103:
104: FND_STATS.Gather_Table_Stats(G_UN_FND, 'ad_patch_hist_snaps_temp');
105:
106: if G_DEBUG then
107: put_line('Inserting new bugfixes in the curr-vw snapshot');
108: end if;
123: t.bug_id,
124: 'EXPLICIT',
125: 'Y',
126: sysdate, sysdate, 5, 5
127: from ad_patch_hist_snaps_temp t
128: where t.action_code = L_BUGSTAT_EXPL_ACT_CD
129: and not exists (select 'Bug not yet recorded in the curr-vw'
130: from ad_snapshot_bugfixes sb2
131: where sb2.snapshot_id = p_snapshot_id
152: sb.last_update_date = sysdate,
153: sb.last_updated_by = 5
154: where sb.snapshot_id = p_snapshot_id
155: and sb.bugfix_id in (select t.bug_id
156: from ad_patch_hist_snaps_temp t
157: where t.action_code = L_BUGSTAT_EXPL_ACT_CD)
158: and (sb.bug_status <> 'EXPLICIT' or
159: sb.success_flag <> 'Y');
160:
185: ad_snapshot_bugfixes_s.nextval,
186: p_global_snapshot_id, t.bug_id,
187: 'EXPLICIT', 'Y',
188: sysdate, sysdate, 5, 5
189: from ad_patch_hist_snaps_temp t
190: where t.action_code = L_BUGSTAT_EXPL_ACT_CD
191: and not exists (select 'Bug not yet recorded in the curr-vw'
192: from ad_snapshot_bugfixes sb2
193: where sb2.snapshot_id = p_global_snapshot_id
214: sb.last_updated_by = 5,
215: sb.inconsistent_flag = null
216: where sb.snapshot_id = p_global_snapshot_id
217: and sb.bugfix_id in (select t.bug_id
218: from ad_patch_hist_snaps_temp t
219: where t.action_code = L_BUGSTAT_EXPL_ACT_CD)
220: and (sb.bug_status <> 'EXPLICIT' or
221: sb.success_flag <> 'Y');
222:
239:
240:
241: if p_delete_junk_created then
242:
243: delete from ad_patch_hist_snaps_temp
244: where action_code = L_BUGSTAT_EXPL_ACT_CD;
245:
246: end if;
247:
290: if G_DEBUG then
291: put_line('About to insert PR-IDs into temp table - 2');
292: end if;
293:
294: insert into ad_patch_hist_snaps_temp
295: (
296: patch_run_id, action_code
297: )
298: select
299: patch_run_id, G_PR_ID_ACT_CD2
300: from ad_patch_runs
301: where appl_top_id = l_appl_top_id
302: and patch_run_id not in (select patch_run_id
303: from ad_patch_hist_snaps_temp
304: where action_code in (G_PR_ID_ACT_CD,
305: G_PR_ID_ACT_CD2));
306:
307: if G_DEBUG then
331: p_delete_junk_created => TRUE);
332:
333: -- Now delete all G_PR_ID_ACT_CD2 rows from temp table
334:
335: delete from ad_patch_hist_snaps_temp
336: where action_code = G_PR_ID_ACT_CD2;
337:
338: end if;
339:
544: 'from ad_snapshot_files sf, ad_file_versions afv ';
545:
546: if p_limit_to_candidate_files then
547: l_str2 :=
548: ', ad_patch_hist_snaps_temp t ' ||
549: 'where t.file_id = sf.file_id '||
550: 'and t.action_code in (:1, :2, :3) and ';
551: else
552: l_str2 := ' where ';
949: where pr.patch_run_id = p_patch_run_id
950: and pr.appl_top_id = p_appl_top_id;
951: end if;
952:
953: delete from ad_patch_hist_snaps_temp;
954:
955: if G_DEBUG then
956: put_line('About to insert PR-ID into temp table');
957: end if;
955: if G_DEBUG then
956: put_line('About to insert PR-ID into temp table');
957: end if;
958:
959: insert into ad_patch_hist_snaps_temp
960: (
961: action_code, patch_run_id
962: )
963: select G_PR_ID_ACT_CD, pr.patch_run_id
1058: if G_DEBUG then
1059: put_line('About to insert PR-IDs into temp table');
1060: end if;
1061:
1062: insert into ad_patch_hist_snaps_temp
1063: (
1064: patch_run_id, action_code
1065: )
1066: select
1067: patch_run_id, G_PR_ID_ACT_CD
1068: from ad_patch_runs
1069: where appl_top_id = p_appl_top_id
1070: and patch_run_id not in (select patch_run_id
1071: from ad_patch_hist_snaps_temp
1072: where action_code = G_PR_ID_ACT_CD);
1073:
1074: if G_DEBUG then
1075: put_line('Inserted '||to_char(sql%rowcount)||' PR-ID rows');
1081: -- prior use. For that, first commit.
1082:
1083: commit;
1084:
1085: fnd_stats.gather_table_stats(G_UN_FND, 'ad_patch_hist_snaps_temp');
1086:
1087: -- set some flags, that help us fine-tune SQL's down the line
1088:
1089: l_only_one_driver_row := FALSE;
1090: l_copy_actions_exist := TRUE;
1091:
1092: select nvl(count(*), 0)
1093: into l_count
1094: from ad_patch_hist_snaps_temp;
1095:
1096: if l_count = 0 then
1097: goto return_success;
1098: elsif l_count = 1 then
1105:
1106: begin
1107: select 1
1108: into l_count
1109: from ad_patch_hist_snaps_temp t,
1110: ad_patch_runs pr,
1111: ad_patch_drivers pd
1112: where t.patch_run_id = pr.patch_run_id
1113: and pr.patch_driver_id = pd.patch_driver_id
1362: Case 1: 1 patch-run
1363: ------
1364: The SQL to use is:
1365:
1366: insert into ad_patch_hist_snaps_temp
1367: (patch_run_id, action_code, file_id, file_version_id,
1368: app_short_name, filename,
1369: version_segment1, version_segment2,
1370: version_segment3, version_segment4,
1395: max(afv.version_segment7), max(afv.version_segment8),
1396: max(afv.version_segment9), max(afv.version_segment10),
1397: max(afv.translation_level), max(prba.dest_file_id),
1398: max(prba.file_type_flag)
1399: from ad_patch_hist_snaps_temp t, ad_patch_runs pr,
1400: ad_patch_run_bugs prb, ad_patch_run_bug_actions prba,
1401: ad_patch_common_actions pca, ad_file_versions afv, ad_files f
1402: where pr.patch_run_id = t.patch_run_id
1403: and pr.appl_top_id = :at_id
1422: analytic function ROW_NUMBER.
1423:
1424: The SQL to use is:
1425:
1426: insert into ad_patch_hist_snaps_temp
1427: (patch_run_id, action_code, file_id, file_version_id,
1428: app_short_name, filename,
1429: version_segment1, version_segment2,
1430: version_segment3, version_segment4,
1469: afv.version_segment5 desc, afv.version_segment6 desc,
1470: afv.version_segment7 desc, afv.version_segment8 desc,
1471: afv.version_segment9 desc, afv.version_segment10 desc,
1472: afv.translation_level desc nulls last) as r1
1473: from ad_patch_hist_snaps_temp t, ad_patch_runs pr,
1474: ad_patch_run_bugs prb, ad_patch_run_bug_actions prba,
1475: ad_patch_common_actions pca, ad_file_versions afv, ad_files f
1476: where pr.patch_run_id = t.patch_run_id
1477: and pr.appl_top_id = :at_id
1490:
1491: Next, the second SQL (UPDATE stmt) is explained below:
1492:
1493: update
1494: ad_patch_hist_snaps_temp t
1495: set t.action_code = :none_cd
1496: where t.action_code = :clib_cd
1497: and not exists (select
1498: 'libin action exists for this .o (ie. its archived)'
1507:
1508: */
1509:
1510: l_ins_stmt1 :=
1511: 'insert into ad_patch_hist_snaps_temp '||
1512: '(patch_run_id, action_code, file_id, file_version_id, '||
1513: 'app_short_name, filename, '||
1514: 'version_segment1, version_segment2, '||
1515: 'version_segment3, version_segment4, '||
1521:
1522: l_hint := ' ';
1523:
1524: l_from_where :=
1525: 'from ad_patch_hist_snaps_temp t, ad_patch_runs pr, '||
1526: 'ad_patch_run_bugs prb, ad_patch_run_bug_actions prba, '||
1527: 'ad_patch_common_actions pca, ad_file_versions afv, ad_files f '||
1528: 'where pr.patch_run_id = t.patch_run_id '||
1529: 'and pr.appl_top_id = :at_id '||
1661: -- Gather stats regardless of # of rows inserted. For that first commit.
1662:
1663: commit;
1664:
1665: FND_STATS.Gather_Table_Stats(G_UN_FND, 'ad_patch_hist_snaps_temp');
1666:
1667: -- Now issue the 2nd SQL (the UPDATE stmt, to flag the unarchived C object
1668: -- libraries as such)
1669:
1667: -- Now issue the 2nd SQL (the UPDATE stmt, to flag the unarchived C object
1668: -- libraries as such)
1669:
1670: update
1671: ad_patch_hist_snaps_temp t
1672: set t.action_code = L_ARCH_NONE_ACT_CD
1673: where t.action_code = L_ARCH_CLIB_ACT_CD
1674: and not exists (select
1675: 'libin action exists for this .o (ie. its archived)'
1685:
1686: -- Next, update the CLIB_ARCH_FILE_ID column in the temp table.
1687:
1688: update
1689: ad_patch_hist_snaps_temp t
1690: set t.clib_arch_file_id =
1691: (
1692: select f.file_id
1693: from ad_files f
1711: '.o', '.a', 'st.lib')
1712: )
1713: where t.action_code = L_ARCH_CLIB_ACT_CD;
1714:
1715: -- Update information in ad_patch_hist_snaps_temp about the
1716: -- irep_gathered_flag. Since ad_patch_hist_snaps_temp table
1717: -- has information about files which were patched (or newly
1718: -- introduced), set/reset the irep_gathered_flag to 'N' and
1719: -- the last_patched_date to sysdate. The irep_gathered_flag
1712: )
1713: where t.action_code = L_ARCH_CLIB_ACT_CD;
1714:
1715: -- Update information in ad_patch_hist_snaps_temp about the
1716: -- irep_gathered_flag. Since ad_patch_hist_snaps_temp table
1717: -- has information about files which were patched (or newly
1718: -- introduced), set/reset the irep_gathered_flag to 'N' and
1719: -- the last_patched_date to sysdate. The irep_gathered_flag
1720: -- signifies that these files (with the flag set to 'N') have
1725: --
1726: -- Bug 3807737 - sgadag.
1727:
1728: if G_DEBUG then
1729: put_line('Updating irep_gathered_flag data in ad_patch_hist_snaps_temp');
1730: end if;
1731:
1732:
1733: update ad_patch_hist_snaps_temp t
1729: put_line('Updating irep_gathered_flag data in ad_patch_hist_snaps_temp');
1730: end if;
1731:
1732:
1733: update ad_patch_hist_snaps_temp t
1734: set t.irep_gathered_flag = 'N';
1735:
1736:
1737: -- Rupsingh Bug 3675019. 06/07/2004
1777: sysdate, sysdate,
1778: 5, 5, p_appl_top_id,
1779: t.irep_gathered_flag,
1780: sysdate
1781: from ad_patch_hist_snaps_temp t
1782: where t.action_code in (L_ARCH_NONE_ACT_CD, L_ARCH_CLIB_ACT_CD,
1783: L_ARCH_AZIP_ACT_CD)
1784: and not exists (select 'Already exists'
1785: from ad_snapshot_files sf
1840: 'P',
1841: sysdate, sysdate,
1842: 5, 5, p_appl_top_id,
1843: l_inconsistent_flag
1844: from ad_patch_hist_snaps_temp t
1845: where
1846: t.action_code in (L_ARCH_NONE_ACT_CD, L_ARCH_CLIB_ACT_CD,
1847: L_ARCH_AZIP_ACT_CD)
1848: and not exists (select 'Already exists'
1887: (sf.file_version_id, sf.update_source_id,
1888: sf.dest_file_id, sf.file_type_flag, sf.irep_gathered_flag) =
1889: (select t.file_version_id, t.patch_run_id,
1890: t.dest_file_id, t.file_type_flag, t.irep_gathered_flag
1891: from ad_patch_hist_snaps_temp t
1892: where t.file_id = sf.file_id),
1893: sf.update_type = 'P',
1894: sf.last_update_date = sysdate,
1895: sf.last_updated_by = 5,
1895: sf.last_updated_by = 5,
1896: sf.last_patched_date = sysdate
1897: where sf.snapshot_id = l_snapshot_id
1898: and sf.file_id in (select t2.file_id
1899: from ad_patch_hist_snaps_temp t2
1900: where t2.action_code in (L_ARCH_NONE_ACT_CD,
1901: L_ARCH_CLIB_ACT_CD, L_ARCH_AZIP_ACT_CD))
1902: and exists
1903: (
1901: L_ARCH_CLIB_ACT_CD, L_ARCH_AZIP_ACT_CD))
1902: and exists
1903: (
1904: select 'File exists in curr-vw with lower version'
1905: from ad_patch_hist_snaps_temp t, ad_file_versions fv_old
1906: where sf.file_id = t.file_id
1907: and t.file_version_id = fv_old.file_version_id (+)
1908: and sf.file_version_id = fv_old.file_version_id (+)
1909: -- Update only if patch version is higher (code copied from adfilutb.pls)
1975: from ad_patch_common_actions pca,
1976: ad_patch_run_bug_actions prba,
1977: ad_patch_run_bugs prb,
1978: ad_patch_runs pr,
1979: ad_patch_hist_snaps_temp t
1980: where pr.patch_run_id = t.patch_run_id and
1981: pr.appl_top_id = p_appl_top_id and
1982: t.action_code = G_PR_ID_ACT_CD and
1983: pr.patch_run_id = prb.patch_run_id and
2133: --
2134:
2135: -- First, delete unwanted rows from the temp table.
2136:
2137: delete from ad_patch_hist_snaps_temp
2138: where action_code <> G_PR_ID_ACT_CD;
2139:
2140: commit;
2141: