1 PACKAGE BODY hr_job_pos AS
2 /* $Header: pejapdel.pkb 120.0 2005/05/31 10:32:28 appldev noship $ */
3 /*
4 ******************************************************************
5 * *
6 * Copyright (C) 1992 Oracle Corporation UK Ltd., *
7 * Chertsey, England. *
8 * *
9 * All rights reserved. *
10 * *
11 * This material has been provided pursuant to an agreement *
12 * containing restrictions on its use. The material is also *
13 * protected by copyright law. No part of this material may *
14 * be copied or distributed, transmitted or transcribed, in *
15 * any form or by any means, electronic, mechanical, magnetic, *
16 * manual, or otherwise, or disclosed to third parties without *
17 * the express written permission of Oracle Corporation UK Ltd, *
18 * Oracle Park, Bittams Lane, Guildford Road, Chertsey, Surrey, *
19 * England. *
20 * *
21 ******************************************************************
22 ==================================================================
23
24 Name : hr_job_pos (BODY)
25
26 Description : Contains the definition of job and position procedures
27 as declared in the hr_job_pos package header
28
29 Uses : hr_utility
30
31 Change List
32 -----------
33
34 Version Date Author ER/CR No. Description of Change
35 -------+---------+----------+---------+--------------------------
36 70.0 05-APR-93 TMATHERS Date Created
37 70.1 05-APR-93 TMATHERS Change business_group_id into
38 organization id for this test.
39 added exit;
40 70.2 05-APR-93 TMATHERS Changed a comment line.
41 70.3 22-APR-93 TMATHERS Added hr_pos_bg_chk.
42 115.1 02-Oct-99 SCNair Date track position related changes.
43 115.2 26-Jun-00 CCarter Changed per_jobs to per_jobs_v for
44 Job groups.
45 =================================================================
46 */
47 --
48 ----------------------- BEGIN: hr_jp_predelete -------------------
49 --
50 --
51 PROCEDURE hr_jp_predelete(p_organization_id INTEGER
52 ,p_business_group_id INTEGER) is
53 /*
54 NAME
55 hr_jp_predelete
56 DESCRIPTION
57 Battery of tests to see if an organization has jobs and positions
58 and therefore may not be deleted.
59 PARAMETERS
60 p_organization_id : Organization Id of Organization to be deleted.
61 p_business_group_id : Business Group id of Organization to be deleted.
62 */
63 --
64 -- Storage Variable.
65 --
66 l_test_func varchar2(60);
67 --
68 begin
69 --
70 if p_business_group_id = p_organization_id then
71 begin
72 -- Do Any rows Exist in PER_JOBS.
73 hr_utility.set_location('hr_job_pos.hr_jp_predelete',1);
74 select '1'
75 into l_test_func
76 from sys.dual
77 where exists ( select 1
78 from PER_JOBS_V x
79 where x.business_group_id = p_business_group_id);
80 --
81 if SQL%ROWCOUNT >0 THEN
82 hr_utility.set_message(801,'HR_6131_ORG_JOBS_EXIST');
83 hr_utility.raise_error;
84 end if;
85 exception
86 when NO_DATA_FOUND THEN
87 null;
88 end;
89 end if;
90 --
91 begin
92 -- Do Any rows Exist in HR_ALL_POSITIONS_F.
93 --
94 -- Changed 02-Oct-99 SCNair (per_positions to hr_all_positions_f) date tracked position requirement
95 --
96 hr_utility.set_location('hr_job_pos.hr_jp_predelete',2);
97 select '1'
98 into l_test_func
99 from sys.dual
100 where exists ( select 1
101 from HR_ALL_POSITIONS_F x
102 where x.organization_id = p_organization_id);
103 --
104 if SQL%ROWCOUNT >0 THEN
105 hr_utility.set_message(801,'HR_6557_ORG_POSITIONS_EXIST');
106 hr_utility.raise_error;
107 end if;
108 exception
109 when NO_DATA_FOUND THEN
110 null;
111 end;
112 --
113 end hr_jp_predelete;
114 --
115 ------------------------- END: hr_jp_predelete -------------------
116 --
117 ----------------------- BEGIN: hr_pos_bg_chk -------------------
118 procedure hr_pos_bg_chk(
119 p_organization_id INTEGER) is
120 /*
121 NAME
122 hr_pos_bg_chk
123 DESCRIPTION
124 Tests to see if an organization has positions
125 If so it may not be updated to a business group.
126 PARAMETERS
127 p_organization_id : Organization Id of Business group to be created.
128 */
129 --
130 -- Local Storage variable.
131 l_test_func varchar2(60);
132 begin
133 begin
134 -- Doing check on HR_ALL_POSITIONS_F.
135 --
136 -- Changed 02-Oct-99 SCNair (per_positions to HR_ALL_POSITIONS_F) Date tracked position requirement
137 hr_utility.set_location('hr_job_pos.hr_pos_bg_chk',1);
138 select '1'
139 into l_test_func
140 from sys.dual
141 where exists ( select 1
142 from HR_ALL_POSITIONS_F x
143 where x.ORGANIZATION_ID = p_organization_id);
144 --
145 if SQL%ROWCOUNT >0 THEN
146 hr_utility.set_message(801,'HR_6726_BG_POS_EXIST');
147 hr_utility.raise_error;
148 end if;
149 exception
150 when NO_DATA_FOUND THEN
151 null;
152 end;
153 --
154 end hr_pos_bg_chk;
155 ------------------------- END: hr_pos_bg_chk -------------------
156 --
157 end hr_job_pos;