The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE update_res_group_relate_pre
(P_GROUP_RELATE_ID IN JTF_RS_GRP_RELATIONS.GROUP_RELATE_ID%TYPE,
P_START_DATE_ACTIVE IN JTF_RS_GRP_RELATIONS.START_DATE_ACTIVE%TYPE DEFAULT FND_API.G_MISS_DATE,
P_END_DATE_ACTIVE IN JTF_RS_GRP_RELATIONS.END_DATE_ACTIVE%TYPE DEFAULT FND_API.G_MISS_DATE,
P_OBJECT_VERSION_NUM IN JTF_RS_GRP_RELATIONS.OBJECT_VERSION_NUMBER%TYPE,
P_DATA OUT NOCOPY VARCHAR2,
P_COUNT OUT NOCOPY NUMBER,
P_RETURN_CODE OUT NOCOPY VARCHAR2
) IS
l_start_date DATE;
l_api_name VARCHAR2(30) := 'update_res_group_relate_pre';
SELECT r.start_date_active, r.end_date_active, r.group_id
FROM jtf_rs_group_usages u,
jtf_rs_grp_relations r
WHERE r.group_relate_id = p_group_relate_id
AND u.group_id = r.group_id AND u.usage = 'SALES_COMP';
SELECT name
FROM cn_comp_groups
WHERE comp_group_id = g_group_id;
SELECT p.period_id,
greatest(p_start_date, p.start_date) start_date,
Decode(p_end_date, NULL, p.end_date, Least(p_end_date, p.end_date)) end_date
FROM cn_srp_intel_periods p
WHERE p.salesrep_id = p_salesrep_id
AND (p_end_date IS NULL OR p.start_date <= p_end_date)
AND (p.end_date >= p_start_date);
select distinct ct.name name,
ct.comp_team_id team_id,
greatest(p_start_date, cg.start_date_active, ct.start_date_active) start_date,
least(nvl(ct.end_date_active, l_max_date), nvl(cg.end_date_active, l_max_date), nvl(p_end_date, l_max_date)) end_date
from cn_srp_comp_teams_v srt, cn_comp_teams ct, cn_srp_comp_groups_v cg
where (p_salesrep_id IS NULL or srt.salesrep_id = p_salesrep_id)
and (p_salesrep_id IS NULL or cg.salesrep_id = p_salesrep_id)
and cg.comp_group_id = p_group_id
and srt.comp_team_id = ct.comp_team_id
and (cg.start_date_active <= ct.start_date_active
or cg.start_date_active between ct.start_date_active and nvl (ct.end_date_active, cg.start_date_active))
and nvl(cg.end_date_active, ct.start_date_active) >= ct.start_date_active
and (cg.end_date_active IS NULL OR p_start_date <= cg.end_date_active)
and (p_end_date IS NULL OR p_end_date >= cg.start_date_active);
SELECT org_id FROM cn_repositories_all WHERE status = 'A';
-- delete the period (g_start_date_old, p_start_date_active) which is not active any more
IF (p_start_date_active > g_start_date_old) THEN
IF (g_end_date_old IS NOT NULL AND g_end_date_old < p_start_date_active) THEN
l_end_date := g_end_date_old;
p_action => 'DELETE_ROLL_PULL',
p_action_link_id => NULL,
p_base_salesrep_id => NULL,
p_base_comp_group_id => NULL,
p_event_log_id => g_event_log_id,
x_action_link_id => l_roll_action_link_id,
p_org_id => o.org_id);
l_srp_tbl.DELETE;
-- delete the period (p_end_date_active, g_end_date_old) which is not active any more
IF ((g_end_date_old IS NULL AND p_end_date_active IS NOT NULL) OR p_end_date_active < g_end_date_old) THEN
IF (p_end_date_active < g_start_date_old) THEN
l_start_date := g_start_date_old;
p_action => 'DELETE_ROLL_PULL',
p_action_link_id => NULL,
p_base_salesrep_id => NULL,
p_base_comp_group_id => NULL,
p_event_log_id => g_event_log_id,
x_action_link_id => l_roll_action_link_id,
p_org_id => o.org_id);
l_srp_tbl.DELETE;
END update_res_group_relate_pre;
PROCEDURE delete_res_group_relate_pre
(P_GROUP_RELATE_ID IN JTF_RS_GRP_RELATIONS.GROUP_RELATE_ID%TYPE,
P_OBJECT_VERSION_NUM IN JTF_RS_GROUPS_VL.OBJECT_VERSION_NUMBER%TYPE,
P_DATA OUT NOCOPY VARCHAR2,
P_COUNT OUT NOCOPY NUMBER,
P_RETURN_CODE OUT NOCOPY VARCHAR2
) IS
l_event_log_id NUMBER;
l_api_name VARCHAR2(30) := 'delete_res_group_relate_pre';
SELECT r.start_date_active, r.end_date_active, r.group_id
FROM jtf_rs_group_usages u,
jtf_rs_grp_relations r
WHERE r.group_relate_id = p_group_relate_id
AND u.group_id = r.group_id AND u.usage = 'SALES_COMP';
SELECT name
FROM cn_comp_groups
WHERE comp_group_id = l_group_id;
SELECT p.period_id,
greatest(p_start_date, p.start_date) start_date,
Decode(p_end_date, NULL, p.end_date, Least(p_end_date, p.end_date)) end_date
FROM cn_srp_intel_periods p
WHERE p.salesrep_id = p_salesrep_id
AND (p_end_date IS NULL OR p.start_date <= p_end_date)
AND (p.end_date >= p_start_date);
select distinct ct.name name,
ct.comp_team_id team_id,
greatest(p_start_date, cg.start_date_active, ct.start_date_active) start_date,
Least(nvl(ct.end_date_active, l_max_date), nvl(cg.end_date_active, l_max_date), nvl(p_end_date, l_max_date)) end_date
from cn_srp_comp_teams_v srt, cn_comp_teams ct, cn_srp_comp_groups_v cg
where (p_salesrep_id IS NULL or srt.salesrep_id = p_salesrep_id)
and (p_salesrep_id IS NULL or cg.salesrep_id = p_salesrep_id)
and cg.comp_group_id = p_group_id
and srt.comp_team_id = ct.comp_team_id
and (cg.start_date_active <= ct.start_date_active
or cg.start_date_active between ct.start_date_active and nvl (ct.end_date_active, cg.start_date_active))
and nvl(cg.end_date_active, ct.start_date_active) >= ct.start_date_active
and (cg.end_date_active IS NULL OR p_start_date <= cg.end_date_active)
and (p_end_date IS NULL OR p_end_date >= cg.start_date_active);
SELECT org_id FROM cn_repositories_all WHERE status = 'A';
( p_event_name => 'CHANGE_CP_HIER_DELETE',
p_object_name => l_group_name,
p_object_id => l_group_id,
p_start_date => NULL,
p_start_date_old => l_start_date,
p_end_date => NULL,
p_end_date_old => l_end_date,
x_event_log_id => l_event_log_id,
p_org_id => o.org_id);
p_action => 'DELETE_ROLL_PULL',
p_action_link_id => NULL,
p_base_salesrep_id => NULL,
p_base_comp_group_id => NULL,
p_event_log_id => l_event_log_id,
x_action_link_id => p_action_link_id,
p_org_id => o.org_id);
l_srp_tbl.DELETE;
END delete_res_group_relate_pre;
SELECT 1
FROM jtf_rs_group_usages
WHERE group_id = p_group_id AND usage = 'SALES_COMP';
SELECT name
FROM cn_comp_groups
WHERE comp_group_id = p_group_id;
SELECT p.period_id,
greatest(p_start_date, p.start_date) start_date,
Decode(p_end_date, NULL, p.end_date, Least(p_end_date, p.end_date)) end_date
FROM cn_srp_intel_periods p
WHERE p.salesrep_id = p_salesrep_id
AND (p_end_date IS NULL OR p.start_date <= p_end_date)
AND (p.end_date >= p_start_date);
select distinct ct.name name,
ct.comp_team_id team_id,
greatest(p_start_date, cg.start_date_active, ct.start_date_active) start_date,
least(nvl(ct.end_date_active, l_max_date), nvl(cg.end_date_active, l_max_date), nvl(p_end_date, l_max_date)) end_date
from cn_srp_comp_teams_v srt, cn_comp_teams ct, cn_srp_comp_groups_v cg
where srt.salesrep_id = p_salesrep_id
and cg.salesrep_id = p_salesrep_id
and cg.comp_group_id = p_group_id
and srt.comp_team_id = ct.comp_team_id
and (cg.start_date_active <= ct.start_date_active
or cg.start_date_active between ct.start_date_active and nvl (ct.end_date_active, cg.start_date_active))
and nvl(cg.end_date_active, ct.start_date_active) >= ct.start_date_active
and (cg.end_date_active IS NULL OR p_start_date <= cg.end_date_active)
and (p_end_date IS NULL OR p_end_date >= cg.start_date_active);
SELECT org_id FROM cn_repositories_all WHERE status = 'A';
l_srp_tbl.DELETE;
PROCEDURE update_res_group_relate_post
(P_GROUP_RELATE_ID IN JTF_RS_GRP_RELATIONS.GROUP_RELATE_ID%TYPE,
P_START_DATE_ACTIVE IN JTF_RS_GRP_RELATIONS.START_DATE_ACTIVE%TYPE DEFAULT FND_API.G_MISS_DATE,
P_END_DATE_ACTIVE IN JTF_RS_GRP_RELATIONS.END_DATE_ACTIVE%TYPE DEFAULT FND_API.G_MISS_DATE,
P_OBJECT_VERSION_NUM IN JTF_RS_GRP_RELATIONS.OBJECT_VERSION_NUMBER%TYPE,
P_DATA OUT NOCOPY VARCHAR2,
P_COUNT OUT NOCOPY NUMBER,
P_RETURN_CODE OUT NOCOPY VARCHAR2
) IS
l_start_date DATE;
l_api_name VARCHAR2(30) := 'update_res_group_relate_post';
SELECT p.period_id,
greatest(p_start_date, p.start_date) start_date,
Decode(p_end_date, NULL, p.end_date, Least(p_end_date, p.end_date)) end_date
FROM cn_srp_intel_periods p
WHERE p.salesrep_id = p_salesrep_id
AND (p_end_date IS NULL OR p.start_date <= p_end_date)
AND (p.end_date >= p_start_date);
select distinct ct.name name,
ct.comp_team_id team_id,
greatest(p_start_date, cg.start_date_active, ct.start_date_active) start_date,
Least(nvl(ct.end_date_active, l_max_date), nvl(cg.end_date_active, l_max_date), nvl(p_end_date, l_max_date) ) end_date
from cn_srp_comp_teams_v srt, cn_comp_teams ct, cn_srp_comp_groups_v cg
where srt.salesrep_id = p_salesrep_id
and cg.salesrep_id = p_salesrep_id
and cg.comp_group_id = p_group_id
and srt.comp_team_id = ct.comp_team_id
and (cg.start_date_active <= ct.start_date_active
or cg.start_date_active between ct.start_date_active and nvl (ct.end_date_active, cg.start_date_active))
and nvl(cg.end_date_active, ct.start_date_active) >= ct.start_date_active
and (cg.end_date_active IS NULL OR p_start_date <= cg.end_date_active)
and (p_end_date IS NULL OR p_end_date >= cg.start_date_active);
SELECT org_id FROM cn_repositories_all WHERE status = 'A';
-- insert the period(p_start_date_active, g_start_date_old) which becomes active
IF (p_start_date_active < g_start_date_old) THEN
IF (p_end_date_active IS NOT NULL AND p_end_date_active < g_start_date_old) THEN
l_end_date := p_end_date_active;
l_srp_tbl.DELETE;
-- insert the period (l_end_date_old, p_end_date_active) which becomes active.
IF ((p_end_date_active IS NULL AND g_end_date_old IS NOT NULL) OR p_end_date_active > g_end_date_old) THEN
IF (g_end_date_old < p_start_date_active) THEN
l_start_date := p_start_date_active;
l_srp_tbl.DELETE;
END update_res_group_relate_post;
PROCEDURE delete_res_group_relate_post
(P_GROUP_RELATE_ID IN JTF_RS_GRP_RELATIONS.GROUP_RELATE_ID%TYPE,
P_OBJECT_VERSION_NUM IN JTF_RS_GROUPS_VL.OBJECT_VERSION_NUMBER%TYPE,
P_DATA OUT NOCOPY VARCHAR2,
P_COUNT OUT NOCOPY NUMBER,
P_RETURN_CODE OUT NOCOPY VARCHAR2
) IS
BEGIN
p_return_code := fnd_api.g_ret_sts_success;
END delete_res_group_relate_post;