The following lines contain the word 'select', 'insert', 'update' or 'delete':
select name
from amw_process;
insert_row_cnt NUMBER;
select fnd_profile.value('AMW_SET_STD_PROCESS') into l_std_process_flag from dual;
insert_row_cnt := 0;
select 1
into l_dummy
from amw_process
where name = v_child_name(i);
insert_row_cnt := insert_row_cnt + 1;
v_forall_list(insert_row_cnt) := v_child_name(i);
select 1
into l_dummy
from amw_process
where name = v_parent_name(j);
insert_row_cnt := insert_row_cnt + 1;
v_forall_list(insert_row_cnt) := v_parent_name(j);
insert_row_cnt := 0;
insert_row_cnt := insert_row_cnt + 1;
v_forall_list(insert_row_cnt) := v_final_list(v_index);
INSERT INTO amw_process( PROCESS_REV_ID,
PROCESS_ID,
SIGNIFICANT_PROCESS_FLAG,
STANDARD_PROCESS_FLAG,
APPROVAL_STATUS,
CERTIFICATION_STATUS,
PROCESS_OWNER_ID,
PROCESS_CATEGORY,
APPLICATION_OWNER_ID,
FINANCE_OWNER_ID,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
OBJECT_VERSION_NUMBER,
ITEM_TYPE,
NAME )
VALUES
(AMW_PROCESS_S.nextval,
AMW_PROCESS_S.nextval,
p_SIGNIFICANT_PROCESS_FLAG,
l_std_process_flag,
p_APPROVAL_STATUS,
p_CERTIFICATION_STATUS,
decode(p_PROCESS_OWNER_ID, -1, to_number(null), p_PROCESS_OWNER_ID),
p_PROCESS_CATEGORY,
decode(p_APPLICATION_OWNER_ID, -1, to_number(null), p_APPLICATION_OWNER_ID),
decode(p_FINANCE_OWNER_ID, -1, to_number(null), p_FINANCE_OWNER_ID),
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1,
'AUDITMGR',
v_forall_final_list(v_ind));
v_parent_name.delete;
v_child_name.delete;
select CHILD_PROCESS_NAME
from amw_wf_hierarchy_v
where PARENT_PROCESS_NAME=l_name;
select PARENT_PROCESS_NAME
from amw_wf_hierarchy_v
where CHILD_PROCESS_NAME=l_name;
** type t_delete_list IS table of amw_process.name%type INDEX BY BINARY_INTEGER;
** v_delete_list t_delete_list;
** delete_row_cnt NUMBER;
** select name
** from amw_process;
** select name
** into root_process_name
** from amw_process
** where process_id = -1;
** delete_row_cnt := 0;
** delete_row_cnt := delete_row_cnt + 1;
** v_delete_list(delete_row_cnt) := v_amwp_name(v_index);
** v_index := v_delete_list.first;
** fnd_file.put_line(fnd_file.log, 'PRINTING DELETE LIST');
** while v_index <= v_delete_list.last
** loop
** fnd_file.put_line(fnd_file.log, 'index: '||v_index||' value: '||v_delete_list(v_index));
** v_index := v_delete_list.next(v_index);
** FORALL v_ind IN 1..delete_row_cnt
** DELETE from amw_process
** where name = v_delete_list(v_ind);
** v_child_name.delete;
** v_child_list.delete;
** v_delete_list.delete;
v_transition_parent_list.delete;
select to_process_activity
from wf_activity_transitions
where from_process_activity = l_instance_id;
select PARENT_PROCESS_ID
from Amw_Process_Org_Relations
where CHILD_PROCESS_ID=l_process_id
and organization_id = l_org_id;
select CHILD_PROCESS_ID
from Amw_Process_Org_Relations
where PARENT_PROCESS_ID=l_process_id
and organization_id = l_org_id;
select process_id, risk_count, control_count, 0, 0 from amw_process;
insert_row_cnt number;
update amw_process ap
set risk_count =
(select count(ara.risk_id)
from amw_risk_associations ara
where pk1 = ap.process_id
and object_type = 'PROCESS'),
control_count =
(select count(distinct aca.control_id)
from amw_control_associations aca, amw_risk_associations ara
where ara.pk1 = ap.process_id
and ara.object_type = 'PROCESS'
and aca.pk1 = ara.risk_id
and aca.object_type = 'RISK');
select nvl(sum(risk_count), 0), nvl(sum(control_count), 0)
into l_risk_count, l_control_count
from amw_process amwp, Amw_Proc_Hierarchy_Denorm apdenorm
where apdenorm.process_id = v_index
and apdenorm.up_down_ind = 'D'
and amwp.process_id = apdenorm.parent_child_id;
update amw_process
set risk_count = v_amw_counts(v_index).risk_count,
control_count = v_amw_counts(v_index).control_count
where process_id = v_index;
select process_id, risk_count, control_count, 0, 0
from amw_process_organization
where organization_id = l_org_id
and end_date is null;
select distinct organization_id from amw_process_organization where organization_id = nvl(p_org_id, organization_id) and end_date is null;
insert_row_cnt number;
update amw_process_organization apo
set risk_count =
(select count(ara.risk_id)
from amw_risk_associations ara
where pk1 = apo.process_organization_id
and object_type = 'PROCESS_ORG'),
control_count =
(select count(distinct aca.control_id)
from amw_control_associations aca, amw_risk_associations ara
where ara.pk1 = apo.process_organization_id
and ara.object_type = 'PROCESS_ORG'
and aca.pk1 = ara.risk_association_id
and aca.object_type = 'RISK_ORG')
where organization_id = nvl(p_org_id, organization_id)
and end_date is null;
select nvl(sum(risk_count), 0), nvl(sum(control_count), 0)
into l_risk_count, l_control_count
from amw_process_organization amwp, Amw_Org_Hierarchy_Denorm aodenorm
where aodenorm.organization_id = l_org
and aodenorm.process_id = v_index
and aodenorm.up_down_ind = 'D'
and amwp.process_id = aodenorm.parent_child_id
and amwp.organization_id = l_org
and amwp.end_date is null;
update amw_process_organization
set risk_count = v_amw_porg_counts(v_index).risk_count,
control_count = v_amw_porg_counts(v_index).control_count
where process_id = v_index
and organization_id = l_org
and end_date is null;
v_amw_porg_counts.delete;
select process_id from amw_process_organization where organization_id = l_org_id and end_date is null;
delete from Amw_Org_Hierarchy_Denorm where organization_id = p_org_id;
select 1 into l_dummy
from Amw_Org_Hierarchy_Denorm
where Organization_Id = p_org_id
and Process_Id = v_apo_id(v_index)
and Parent_Child_Id = v_org_parent_id(i)
and Up_Down_Ind = 'U';
insert into Amw_Org_Hierarchy_Denorm
(Organization_Id,
Process_Id,
Parent_Child_Id,
Up_Down_Ind,
Last_Update_Date,
Last_Updated_By,
Creation_Date,
Created_By,
Last_Update_Login,
OBJECT_VERSION_NUMBER
)
values
(p_org_id,
v_apo_id(v_index),
v_org_parent_id(i),
'U',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select 1 into l_dummy
from Amw_Org_Hierarchy_Denorm
where Organization_Id = p_org_id
and Process_Id = v_apo_id(v_index)
and Parent_Child_Id = v_org_child_id(i)
and Up_Down_Ind = 'D';
insert into Amw_Org_Hierarchy_Denorm
(Organization_Id,
Process_Id,
Parent_Child_Id,
Up_Down_Ind,
Last_Update_Date,
Last_Updated_By,
Creation_Date,
Created_By,
Last_Update_Login,
OBJECT_VERSION_NUMBER
)
values
(p_org_id,
v_apo_id(v_index),
v_org_child_id(i),
'D',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select child_nondisp_name
from amw_process_hierarchy_v
where parent_nondisp_name=l_name;
select process_id into parent_id from amw_process where name = p_process_name;
select process_id into child_id from amw_process where name = c1_rec.child_nondisp_name;
select wpa.instance_id
into instance_id
from wf_process_activities wpa,
wf_activities wa
where wpa.process_item_type = 'AUDITMGR'
and wpa.process_name = p_process_name
and wpa.process_name = wa.name
and wa.end_date is null
and wa.item_type = 'AUDITMGR'
and wpa.process_version = wa.version
and wpa.activity_name = c1_rec.child_nondisp_name;
select 1
into l_dummy
from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and PARENT_PROCESS_ID = parent_id
and CHILD_PROCESS_ID = child_id;
insert into Amw_Process_Org_Relations
(ORGANIZATION_ID,
PARENT_PROCESS_ID,
CHILD_PROCESS_ID,
INSTANCE_ID,
EXCEPTION_PRESENT_FLAG,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
OBJECT_VERSION_NUMBER)
values
(p_org_id,
parent_id,
child_id,
instance_id,
'N',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select 1
into l_dummy
from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and PARENT_PROCESS_ID = -1
and CHILD_PROCESS_ID = p_process_id;
insert into Amw_Process_Org_Relations
(ORGANIZATION_ID,
PARENT_PROCESS_ID,
CHILD_PROCESS_ID,
INSTANCE_ID,
EXCEPTION_PRESENT_FLAG,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
OBJECT_VERSION_NUMBER)
values
(p_org_id,
-1,
p_process_id,
0,
'N',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select name
into p_name
from amw_process
where process_id = p_process_id;
select 1
into l_dummy
from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and PARENT_PROCESS_ID = -1
and CHILD_PROCESS_ID = p_process_id;
insert into Amw_Process_Org_Relations
(ORGANIZATION_ID,
PARENT_PROCESS_ID,
CHILD_PROCESS_ID,
INSTANCE_ID,
EXCEPTION_PRESENT_FLAG,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
OBJECT_VERSION_NUMBER)
values
(p_org_id,
-1,
p_process_id,
0,
'N',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select name
into p_name
from amw_process
where process_id = p_process_id;
procedure delete_org_relation(
p_parent_process_id in number,
p_child_process_id in number,
p_org_id in number) is
l_exist number := 0;
select CHILD_PROCESS_ID
from Amw_Process_Org_Relations
where PARENT_PROCESS_ID = l_pid
and organization_id = p_oid;
delete from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and PARENT_PROCESS_ID = p_parent_process_id
and CHILD_PROCESS_ID = p_child_process_id;
select count(ORGANIZATION_ID)
into l_exist
from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and CHILD_PROCESS_ID = p_child_process_id;
delete_org_relation(
p_parent_process_id => p_child_process_id,
p_child_process_id => c1_rec.CHILD_PROCESS_ID,
p_org_id => p_org_id);
end delete_org_relation;
delete from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and CHILD_PROCESS_ID = p_process_id;
delete from amw_process_organization
where organization_id = p_org_id
and end_date is not null;
select CHILD_PROCESS_ID
from Amw_Process_Org_Relations
where PARENT_PROCESS_ID=l_id
and organization_id = l_oid;
delete from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and PARENT_PROCESS_ID = p_process_id
and CHILD_PROCESS_ID = c1_rec.CHILD_PROCESS_ID;
select employee_id
into l_person_id
from AMW_EMPLOYEES_CURRENT_V
where party_id = p_process_owner_party_id;
select watl.display_name
into l_parent_disp_name
from wf_activities_tl watl, wf_activities wa, amw_process ap
where ap.process_id = p_parent_process_id
and ap.name = wa.name
and wa.item_type = 'AUDITMGR'
and wa.end_date is null
and watl.item_type = 'AUDITMGR'
and watl.name = wa.name
and watl.version = wa.version
and watl.language = userenv('LANG');
select watl.display_name
into l_child_disp_name
from wf_activities_tl watl, wf_activities wa, amw_process ap
where ap.process_id = p_child_process_id
and ap.name = wa.name
and wa.item_type = 'AUDITMGR'
and wa.end_date is null
and watl.item_type = 'AUDITMGR'
and watl.name = wa.name
and watl.version = wa.version
and watl.language = userenv('LANG');
select name
into l_org_name
from amw_audit_units_v
where organization_id = p_org_id;
select 1
into l_dummy
from Amw_Process_Org_Relations
where ORGANIZATION_ID = p_org_id
and PARENT_PROCESS_ID = p_parent_process_id
and CHILD_PROCESS_ID = p_child_process_id;
insert into Amw_Process_Org_Relations
(ORGANIZATION_ID,
PARENT_PROCESS_ID,
CHILD_PROCESS_ID,
INSTANCE_ID,
EXCEPTION_PRESENT_FLAG,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
OBJECT_VERSION_NUMBER)
values
(p_org_id,
p_parent_process_id,
p_child_process_id,
0,
p_exception_yes,
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select name
into p_name
from amw_process
where process_id = p_child_process_id;
delete_org_relation(p_parent_process_id, p_child_process_id, p_org_id);
update amw_process amwp
set amwp.org_count = (select count(process_organization_id)
from amw_process_organization amwpo
where amwpo.process_id = amwp.process_id
and amwpo.end_date is null);
select distinct organization_id
from amw_process_organization
where process_id = l_pid
and end_date is null;
select distinct organization_id
from amw_process_organization
where process_id = l_pid
and end_date is null
and organization_id not in
(select distinct old_pk1 from amw_exceptions_b where ((old_pk2 = l_pid and object_type in ('PROCESS','RISK','CONTROL'))or (object_type = 'PROCESS' and old_pk3 = l_pid)) and old_pk1 is not null)
and organization_id not in
(select distinct new_pk1 from amw_exceptions_b where ((new_pk2 = l_pid and object_type in ('PROCESS','RISK','CONTROL'))or (object_type = 'PROCESS' and new_pk3 = l_pid)) and new_pk1 is not null);
select LTRIM(l_org_string, '1234567890') into str from dual;
select SUBSTR(l_org_string, 1, diff) into orgstr from dual;
select LTRIM(str, 'x') into l_org_string from dual;
select parent_process_id
from Amw_Process_Org_Relations
where organization_id = p_org_id
and child_process_id = p_process_id;
insert into Amw_Process_Org_Relations
(ORGANIZATION_ID,
PARENT_PROCESS_ID,
CHILD_PROCESS_ID,
INSTANCE_ID,
EXCEPTION_PRESENT_FLAG,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
OBJECT_VERSION_NUMBER)
values
(p_org_id,
v_parent_pid(v_index),
p_process_id,
0,
'N',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select name
into l_name
from amw_process
where process_id = p_process_id;
select name into l_pname from amw_process where process_id = p_process_id;
select 1 into l_dummy
from amw_process_organization
where end_date is null
and process_id = (select process_id from amw_process where name = v_child_name(i));
select 1 into l_dummy
from amw_process_organization
where process_id = p_process_id
and end_date is null;
select nvl(employee_id, 0) into l_empid from fnd_user where user_id = p_user_id;
select party_id into l_party_id from amw_employees_current_v where employee_id = l_empid;
select 1 into l_dummy
from amw_process_organization
where end_date is null
and organization_id = p_org_id
and process_owner_id = l_party_id;
select nvl(employee_id, 0) into l_empid from fnd_user where user_id = p_user_id;
select org_information2
into l_dummy
from hr_organization_information
where organization_id in (select distinct organization_id from amw_audit_units_v)
and org_information_context = 'Organization Name Alias'
and org_information2 = l_empid;
select 1
into l_dummy
from hr_organization_information
where organization_id = p_org_id
and org_information_context = 'Organization Name Alias'
and org_information2 = l_empid;
select hoi.organization_id
from hr_organization_information hoi, amw_audit_units_v aauv
where hoi.organization_id = aauv.organization_id
and hoi.org_information_context = 'Organization Name Alias'
and hoi.org_information2 = l_emp;
select 1 into l_dummy
from dual where p_org_id in
(select organization_id_child
from
(select organization_id_parent, organization_id_child from per_org_structure_elements
where org_structure_version_id =
(select org_structure_version_id from per_org_structure_versions
where date_to is null and organization_structure_id =
(select organization_structure_id from per_organization_structures where name = hier_name)))
start with organization_id_parent = l_org
connect by organization_id_parent = prior organization_id_child);
select b2.process_id
from amw_wf_hierarchy_v a, amw_process b1, amw_process b2
where b1.name = a.parent_process_name
and b1.item_type = a.parent_item_type
and b2.name = a.child_process_name
and b2.item_type = a.child_item_type
and b1.process_id = l_id;
select b1.process_id
from amw_wf_hierarchy_v a, amw_process b1, amw_process b2
where b1.name = a.parent_process_name
and b1.item_type = a.parent_item_type
and b2.name = a.child_process_name
and b2.item_type = a.child_item_type
and b2.process_id = l_id;
select process_id from amw_process;
delete from Amw_Proc_Hierarchy_Denorm;
select 1 into l_dummy
from Amw_Proc_Hierarchy_Denorm
where Process_Id = l_process_id
and Parent_Child_Id = l_parent_id
and Up_Down_Ind = 'U';
insert into Amw_Proc_Hierarchy_Denorm
(Process_Id,
Parent_Child_Id,
Up_Down_Ind,
Last_Update_Date,
Last_Updated_By,
Creation_Date,
Created_By,
Last_Update_Login,
OBJECT_VERSION_NUMBER
)
values
(l_process_id,
l_parent_id,
'U',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
select 1 into l_dummy
from Amw_Proc_Hierarchy_Denorm
where Process_Id = l_process_id
and Parent_Child_Id = l_child_id
and Up_Down_Ind = 'D';
insert into Amw_Proc_Hierarchy_Denorm
(Process_Id,
Parent_Child_Id,
Up_Down_Ind,
Last_Update_Date,
Last_Updated_By,
Creation_Date,
Created_By,
Last_Update_Login,
OBJECT_VERSION_NUMBER
)
values
(l_process_id,
l_child_id,
'D',
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
G_LOGIN_ID,
1);
type t_delete_list IS table of amw_process.name%type index by binary_integer;
v_delete_list t_delete_list;
type t_delete_pid_list IS table of amw_process.process_id%type index by binary_integer;
v_delete_pid_list t_delete_pid_list;
delete_row_cnt NUMBER;
select name, process_id
from amw_process;
select organization_id
from amw_process_organization
where process_id = p_pid;
select exception_id
from amw_exceptions_b
where object_type = 'PROCESS_VARIANT_ADD'
and new_pk1 not in
(select process_id from amw_process where standard_process_flag = 'Y');
select name
into root_process_name
from amw_process
where process_id = -1;
delete_row_cnt := 0;
delete_row_cnt := delete_row_cnt + 1;
v_delete_list(delete_row_cnt) := v_amwp_name(v_index);
v_index := v_delete_list.first;
while v_index <= v_delete_list.last
loop
-- opportunity for performance improvement exist
select process_id
into v_delete_pid_list(v_index)
from amw_process
where item_type = 'AUDITMGR'
and name = v_delete_list(v_index);
v_index := v_delete_list.next(v_index);
v_index := v_delete_pid_list.first;
while v_index <= v_delete_pid_list.last
loop
open c_org( v_delete_pid_list(v_index) );
disassociate_process_org(p_process_id => v_delete_pid_list(v_index),
p_org_id => v_org(v_index1),
x_return_status => x_return_status1,
x_msg_count => x_msg_count1,
x_msg_data => x_msg_data1);
v_index := v_delete_pid_list.next(v_index);
FORALL v_ind IN 1..delete_row_cnt
DELETE from amw_risk_associations
where pk1 = v_delete_pid_list(v_ind)
and object_type = 'PROCESS';
FORALL v_ind IN 1..delete_row_cnt
DELETE from amw_objective_associations
where pk1 = v_delete_pid_list(v_ind)
and object_type = 'PROCESS';
FORALL v_ind IN 1..delete_row_cnt
DELETE from amw_process
where name = v_delete_list(v_ind);
FORALL v_ind IN 1..delete_row_cnt
update wf_activities
set end_date = sysdate
where name = v_delete_list(v_ind)
and item_type = 'AUDITMGR'
and end_date is null;
v_child_name.delete;
v_delete_list.delete;
v_delete_pid_list.delete;
update amw_process ap1
set ap1.standard_variation =
(select ap2.process_id from amw_process ap2 where ap2.process_id = ap1.standard_variation);
delete from amw_exceptions_b where exception_id = l_ex_id;
delete from amw_exceptions_reasons where exception_id = l_ex_id;
delete from amw_exceptions_tl where exception_id = l_ex_id;
delete from amw_process a where not exists
(select name from wf_activities w where w.name = a.name and w.item_type = 'AUDITMGR' and w.end_date is null);
type t_delete_list IS table of amw_process.name%type index by binary_integer;
v_delete_list t_delete_list;
type t_delete_pid_list IS table of amw_process.process_id%type index by binary_integer;
v_delete_pid_list t_delete_pid_list;
delete_row_cnt NUMBER;
select name, process_id
from amw_process;
select organization_id
from amw_process_organization
where process_id = p_pid;
select exception_id
from amw_exceptions_b
where object_type = 'PROCESS_VARIANT_ADD'
and new_pk1 not in
(select process_id from amw_process where standard_process_flag = 'Y');
select name
into root_process_name
from amw_process
where process_id = -1;
delete_row_cnt := 0;
delete_row_cnt := delete_row_cnt + 1;
v_delete_list(delete_row_cnt) := v_amwp_name(v_index);
v_index := v_delete_list.first;
while v_index <= v_delete_list.last
loop
select process_id
into v_delete_pid_list(v_index)
from amw_process
where item_type = 'AUDITMGR'
and name = v_delete_list(v_index);
v_index := v_delete_list.next(v_index);
v_index := v_delete_pid_list.first;
while v_index <= v_delete_pid_list.last
loop
open c_org( v_delete_pid_list(v_index) );
disassociate_process_org(p_process_id => v_delete_pid_list(v_index),
p_org_id => v_org(v_index1),
x_return_status => x_return_status1,
x_msg_count => x_msg_count1,
x_msg_data => x_msg_data1);
v_index := v_delete_pid_list.next(v_index);
FORALL v_ind IN 1..delete_row_cnt
DELETE from amw_risk_associations
where pk1 = v_delete_pid_list(v_ind)
and object_type = 'PROCESS';
FORALL v_ind IN 1..delete_row_cnt
DELETE from amw_objective_associations
where pk1 = v_delete_pid_list(v_ind)
and object_type = 'PROCESS';
FORALL v_ind IN 1..delete_row_cnt
DELETE from amw_process
where name = v_delete_list(v_ind);
FORALL v_ind IN 1..delete_row_cnt
update wf_activities
set end_date = sysdate
where name = v_delete_list(v_ind)
and item_type = 'AUDITMGR'
and end_date is null;
v_child_name.delete;
v_delete_list.delete;
v_delete_pid_list.delete;
update amw_process ap1
set ap1.standard_variation =
(select ap2.process_id from amw_process ap2 where ap2.process_id = ap1.standard_variation);
delete from amw_exceptions_b where exception_id = l_ex_id;
delete from amw_exceptions_reasons where exception_id = l_ex_id;
delete from amw_exceptions_tl where exception_id = l_ex_id;
delete from amw_process a where not exists
(select name from wf_activities w where w.name = a.name and w.item_type = 'AUDITMGR' and w.end_date is null);