1 PACKAGE BODY PER_JOB_REQUIREMENTS_PKG as
2 /* $Header: pejbr01t.pkb 115.1 99/07/18 13:55:06 porting ship $ */
3 --
4 procedure get_next_sequence(p_job_requirement_id in out number) is
5 --
6 cursor c1 is select per_job_requirements_s.nextval
7 from sys.dual;
8 --
9 begin
10 --
11 -- Retrieve the next sequence number for job_requirement_id
12 --
13 if (p_job_requirement_id is null) then
14 open c1;
15 fetch c1 into p_job_requirement_id;
16 if (C1%NOTFOUND) then
17 CLOSE C1;
18 hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
19 hr_utility.set_message_token('PROCEDURE','get_next_sequence');
20 hr_utility.set_message_token('STEP','1');
21 end if;
22 close c1;
23 end if;
24 --
25 hr_utility.set_location('PER_JOB_REQUIREMENTS_PKG.get_next_sequence', 1);
26 --
27 end get_next_sequence;
28 --
29 procedure check_unique_requirement(p_job_id in number,
30 p_analysis_criteria_id in number,
31 p_rowid in varchar2) is
32 --
33 cursor csr_requirement is select null
34 from per_job_requirements pjr
35 where ((p_rowid is not null and
36 rowidtochar(rowid) <> p_rowid )
37 or p_rowid is null)
38 and pjr.job_id = p_job_id
39 and pjr.analysis_criteria_id = p_analysis_criteria_id;
40 --
41 g_dummy_number number;
42 v_not_unique boolean := FALSE;
43 --
44 begin
45 --
46 -- Check the requirement name is unique
47 --
48 open csr_requirement;
49 fetch csr_requirement into g_dummy_number;
50 v_not_unique := csr_requirement%FOUND;
51 close csr_requirement;
52 --
53 if v_not_unique then
54 hr_utility.set_message(801,'HR_6644_JOB_REQ_DUP');
55 hr_utility.raise_error;
56 end if;
57 --
58 hr_utility.set_location('PER_JOB_REQUIREMENTS_PKG.check_unique_requirement', 1);
59 --
60 end check_unique_requirement;
61 --
62 END PER_JOB_REQUIREMENTS_PKG;