[Home] [Help]
135: where pattern_id = g_pattern_pattern_id_final_tbl(i);
136: end if;
137:
138: -- delete the records where pricing_phase_id matches to avoid duplicates
139: delete from qp_pattern_phases a
140: where a.pattern_id = g_pattern_pattern_id_final_tbl(i)
141: and a.pricing_phase_id in (select b.pricing_phase_id
142: from qp_pattern_phases b
143: where b.pattern_id = l_min_pattern_id);
138: -- delete the records where pricing_phase_id matches to avoid duplicates
139: delete from qp_pattern_phases a
140: where a.pattern_id = g_pattern_pattern_id_final_tbl(i)
141: and a.pricing_phase_id in (select b.pricing_phase_id
142: from qp_pattern_phases b
143: where b.pattern_id = l_min_pattern_id);
144:
145: -- update the records where pricing_phase_id DO NOT matches
146: update qp_pattern_phases
142: from qp_pattern_phases b
143: where b.pattern_id = l_min_pattern_id);
144:
145: -- update the records where pricing_phase_id DO NOT matches
146: update qp_pattern_phases
147: set pattern_id = l_min_pattern_id
148: where pattern_id = g_pattern_pattern_id_final_tbl(i);
149: end loop;
150: end if;
233: if p_list_header_id is null then
234: -- like upgrade, refresh everything related to patterns
235: IF (FND_INSTALLATION.GET_APP_INFO('QP', l_status, l_industry, l_qp_schema))
236: THEN
237: l_stmt := 'TRUNCATE TABLE ' || l_qp_schema || '.qp_pattern_phases';
238: EXECUTE IMMEDIATE l_stmt;
239: l_stmt := 'TRUNCATE TABLE ' || l_qp_schema || '.qp_attribute_groups';
240: EXECUTE IMMEDIATE l_stmt;
241: l_stmt := 'TRUNCATE TABLE ' || l_qp_schema || '.qp_patterns';
1394: fnd_file.put_line(FND_FILE.LOG, 'Pattern_id='||l_pattern_id);
1395: end if;
1396: */
1397:
1398: -- maintain data in qp_pattern_phases
1399: if p_pattern_type in ('LP', 'PP') then
1400: Populate_Pattern_Phases(null, g_pricing_phase_id_tmp_tbl(grp_no_index), l_pattern_id);
1401: elsif p_pattern_type = 'HP' then
1402: Populate_Pattern_Phases(g_list_header_id_tmp_tbl(grp_no_index), null, l_pattern_id);
1919: end if;
1920: */
1921: FOR j IN l_phase_id_to_insert_csr LOOP
1922: begin
1923: select /*+ index(qp_pp QP_PATTERN_PHASES_N1) */ 'Y'
1924: into l_exists
1925: from qp_pattern_phases qp_pp
1926: where pattern_id = p_pattern_id
1927: and pricing_phase_id = j.pricing_phase_id;
1921: FOR j IN l_phase_id_to_insert_csr LOOP
1922: begin
1923: select /*+ index(qp_pp QP_PATTERN_PHASES_N1) */ 'Y'
1924: into l_exists
1925: from qp_pattern_phases qp_pp
1926: where pattern_id = p_pattern_id
1927: and pricing_phase_id = j.pricing_phase_id;
1928: exception
1929: when no_data_found then
1926: where pattern_id = p_pattern_id
1927: and pricing_phase_id = j.pricing_phase_id;
1928: exception
1929: when no_data_found then
1930: INSERT INTO qp_pattern_phases
1931: (pattern_id,
1932: pricing_phase_id,
1933: creation_date,
1934: created_by,
1971: fnd_file.put_line(FND_FILE.LOG, 'Begin Populate_Pattern_Phases for LP, PP case');
1972: end if;
1973: */
1974: begin
1975: select /*+ index(qp_pp QP_PATTERN_PHASES_N1) */ 'Y'
1976: into l_exists
1977: from qp_pattern_phases qp_pp
1978: where pattern_id = p_pattern_id
1979: and pricing_phase_id = p_pricing_phase_id
1973: */
1974: begin
1975: select /*+ index(qp_pp QP_PATTERN_PHASES_N1) */ 'Y'
1976: into l_exists
1977: from qp_pattern_phases qp_pp
1978: where pattern_id = p_pattern_id
1979: and pricing_phase_id = p_pricing_phase_id
1980: and rownum = 1; -- needed in case same combination is inserted by 2 diff. threads and one has commited before other
1981: exception
1986: else
1987: fnd_file.put_line(FND_FILE.LOG, 'No pattern_phases found; go insert');
1988: end if;
1989: */
1990: INSERT INTO qp_pattern_phases
1991: (pattern_id,
1992: pricing_phase_id,
1993: creation_date,
1994: created_by,