1 PACKAGE BODY wip_person AS
2 /* $Header: wiphrdmb.pls 115.8 2004/02/27 01:46:19 yowang ship $ */
3
4
5 PROCEDURE wip_predel_validation (p_person_id number) IS
6 v_delete_permitted varchar2(1);
7
8 BEGIN
9 /* Sets package variables to store location name and stage number which
10 * enables unexpected errors to be located more easily
11 */
12 hr_utility.set_location('WIP_PERSON.WIP_PREDEL_VALIDATION', 1);
13
14 begin
15 select 'Y'
16 into v_delete_permitted
17 from sys.dual
18 where not exists (
19 select null
20 from wip_employee_labor_rates welr
21 where welr.employee_id = P_PERSON_ID);
22
23 exception
24 when NO_DATA_FOUND then
25 hr_utility.set_message(706, 'WIP_EMPLOYEE_DELETE');
26 hr_utility.raise_error;
27 end;
28
29 hr_utility.set_location('WIP_PERSON.WIP_PREDEL_VALIDATION', 2);
30
31 begin
32 select 'Y'
33 into v_delete_permitted
34 from sys.dual
35 where not exists (
36 select null
37 from wip_transactions wt
38 where wt.employee_id = P_PERSON_ID);
39
40 exception
41 when NO_DATA_FOUND then
42 hr_utility.set_message(706, 'WIP_EMPLOYEE_DELETE');
43 hr_utility.raise_error;
44 end;
45
46
47 hr_utility.set_location('WIP_PERSON.WIP_PREDEL_VALIDATION', 3);
48
49 begin
50 select 'Y'
51 into v_delete_permitted
52 from sys.dual
53 where not exists (
54 select null
55 from bom_resource_employees be,
56 wip_op_resource_instances wi
57 where be.organization_id = wi.organization_id
58 and be.instance_id = wi.instance_id
59 and be.person_id = P_PERSON_ID);
60
61 exception
62 when NO_DATA_FOUND then
63 hr_utility.set_message(706, 'WIP_EMPLOYEE_DELETE');
64 hr_utility.raise_error;
65 end;
66
67 END wip_predel_validation;
68
69 END wip_person;