[Home] [Help]
1408: p_person_id NUMBER) IS
1409:
1410: CURSOR c_sec_stat_cancel IS
1411: select sa.assignment_id
1412: from per_secondary_ass_statuses sa
1413: where sa.business_group_id + 0 = p_business_group_id
1414: and sa.end_date = p_end_date
1415: and exists
1416: ( SELECT s.assignment_id
1413: where sa.business_group_id + 0 = p_business_group_id
1414: and sa.end_date = p_end_date
1415: and exists
1416: ( SELECT s.assignment_id
1417: FROM PER_SECONDARY_ASS_STATUSES s
1418: where s.business_group_id + 0 = p_business_group_id
1419: and s.end_date = p_end_date
1420: and sa.assignment_id = s.assignment_id
1421: and exists
1434: OPEN c_sec_stat_cancel;
1435: LOOP
1436: FETCH c_sec_stat_cancel into v_assignment_id;
1437: EXIT WHEN c_sec_stat_cancel%NOTFOUND;
1438: UPDATE per_secondary_ass_statuses s
1439: SET s.END_DATE = NULL
1440: , s.LAST_UPDATE_DATE = trunc(SYSDATE)
1441: , s.LAST_UPDATED_BY = p_last_updated_by
1442: , s.LAST_UPDATE_LOGIN = p_last_update_login
1466: ,p_last_update_login number
1467: ,p_person_id number) is
1468: -- WWbug 633263
1469: -- Modified cursor for performance improvements by removing the full table
1470: -- scan on per_secondary_ass_statuses.
1471: -- This was achieved by removing the sub-query
1472: cursor chk_sec_stat is
1473: select 1
1474: from per_secondary_ass_statuses s
1470: -- scan on per_secondary_ass_statuses.
1471: -- This was achieved by removing the sub-query
1472: cursor chk_sec_stat is
1473: select 1
1474: from per_secondary_ass_statuses s
1475: ,per_assignments_f a
1476: where s.business_group_id + 0 = p_business_group_id
1477: and s.start_date is not null
1478: and a.business_group_id + 0 = p_business_group_id
1484: between a.effective_start_date
1485: and a.effective_end_date;
1486: -- WWbug 633263
1487: -- Modified cursor for performance improvements by removing the full table
1488: -- scan on per_secondary_ass_statuses.
1489: -- This was achieved by removing the sub-query
1490: cursor c_sec_stat is
1491: select sa.assignment_id
1492: from per_secondary_ass_statuses sa
1488: -- scan on per_secondary_ass_statuses.
1489: -- This was achieved by removing the sub-query
1490: cursor c_sec_stat is
1491: select sa.assignment_id
1492: from per_secondary_ass_statuses sa
1493: ,per_assignments_f paf
1494: where sa.business_group_id + 0 = p_business_group_id
1495: and sa.start_date <= p_end_date
1496: and (sa.end_date is null
1511: if chk_sec_stat%found then
1512: close chk_sec_stat;
1513: -- WWbug 633263
1514: -- Modified cursor for performance improvements by removing the full table
1515: -- scan on per_secondary_ass_statuses.
1516: -- This was achieved by replacing the EXISTS sub-query with an IN sub-query
1517: delete from per_secondary_ass_statuses s
1518: where s.business_group_id + 0 = p_business_group_id
1519: and trunc(s.start_date) > p_end_date
1513: -- WWbug 633263
1514: -- Modified cursor for performance improvements by removing the full table
1515: -- scan on per_secondary_ass_statuses.
1516: -- This was achieved by replacing the EXISTS sub-query with an IN sub-query
1517: delete from per_secondary_ass_statuses s
1518: where s.business_group_id + 0 = p_business_group_id
1519: and trunc(s.start_date) > p_end_date
1520: and s.assignment_id in
1521: (select a.assignment_id
1529: and a.effective_end_date);
1530: -- WWbug 633263
1531: -- Cleared up the previous code with a cursor for loop
1532: for csr_rec in c_sec_stat loop
1533: update per_secondary_ass_statuses s
1534: set s.end_date = p_end_date
1535: , s.last_update_date = trunc(sysdate)
1536: , s.last_updated_by = p_last_updated_by
1537: , s.last_update_login = p_last_update_login