[Home] [Help]
PACKAGE BODY: APPS.PER_ZA_LSA_SHD
Source
1 Package Body per_za_lsa_shd as
2 /* $Header: pezalssh.pkb 115.0 2001/02/04 22:34:10 pkm ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_za_lsa_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'PER_QUALIFICATIONS_FK1') Then
37 hr_utility.set_message(801, 'HR_51850_ass_ATT_ID_FK');
38 hr_utility.raise_error;
39 ElsIf (p_constraint_name = 'PER_QUALIFICATIONS_FK2') Then
40 hr_utility.set_message(801, 'HR_51851_ass_QUAL_TYPE_ID_FK');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'PER_QUALIFICATIONS_FK3') Then
43 hr_utility.set_message(801, 'HR_51852_ass_BUS_GRP_ID_FK');
44 hr_utility.raise_error;
45 ElsIf (p_constraint_name = 'PER_QUALIFICATIONS_UK') Then
46 hr_utility.set_message(801,'HR_51847_ass_REC_EXISTS');
47 hr_utility.raise_error;
48 ElsIf (p_constraint_name = 'PER_ass_CHK_DATES') Then
49 hr_utility.set_message(801, 'HR_51853_ass_DATE_INV');
50 hr_utility.raise_error;
51 ElsIf (p_constraint_name = 'PER_QUALIFICATIONS_PK') Then
52 hr_utility.set_message(801, 'HR_51854_ass_QUAL_ID_PK');
53 hr_utility.raise_error;
54 Else
55 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
56 hr_utility.set_message_token('PROCEDURE', l_proc);
57 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
58 hr_utility.raise_error;
59 End If;
60 --
61 hr_utility.set_location(' Leaving:'||l_proc, 10);
62 End constraint_error;
63 --
64 -- ----------------------------------------------------------------------------
65 -- |---------------------------------< lck >----------------------------------|
66 -- ----------------------------------------------------------------------------
67 Procedure lck
68 (
69 p_agreement_id in number,
70 p_person_id in number
71 ) is
72 --
73 -- Cursor selects the 'current' row from the HR Schema
74 --
75 Cursor C_Sel1 is
76 select
77 AGREEMENT_ID,
78 NAME,
79 DESCRIPTION,
80 AGREEMENT_NUMBER,
81 PERSON_ID,
82 AGREEMENT_START_DATE,
83 AGREEMENT_END_DATE,
84 STATUS,
85 SETA,
86 PROBATIONARY_END_DATE,
87 TERMINATED_BY,
88 LEARNER_TYPE,
89 REASON_FOR_TERMINATION,
90 ACTUAL_END_DATE,
91 AGREEMENT_HARD_COPY_ID,
92 LAST_UPDATE_DATE,
93 LAST_UPDATED_BY,
94 LAST_UPDATE_LOGIN,
95 CREATED_BY,
96 CREATION_DATE
97 from
98 per_za_learnership_agreements
99 where
100 agreement_id = p_agreement_id
101 for update nowait;
102
103 l_proc varchar2(72) := g_package||'lck';
104 --
105 Begin
106 hr_utility.set_location('Entering:'||l_proc, 5);
107 --
108 hr_api.mandatory_arg_error
109 (p_api_name => l_proc,
110 p_argument => 'agreement_id',
111 p_argument_value => p_agreement_id);
112
113 Open C_Sel1;
114 Fetch C_Sel1 Into g_old_rec;
115 If C_Sel1%notfound then
116 Close C_Sel1;
117 --
118 -- The primary key is invalid therefore we must error
119 --
120 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
121 hr_utility.raise_error;
122 End If;
123 Close C_Sel1;
124 --
125 hr_utility.set_location(' Leaving:'||l_proc, 10);
126 --
127 -- We need to trap the ORA LOCK exception
128 --
129 Exception
130 When HR_Api.Object_Locked then
131 --
132 -- The object is locked therefore we need to supply a meaningful
133 -- error message.
134 --
135 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
136 hr_utility.set_message_token('TABLE_NAME', 'per_za_learnership_agreements');
137 hr_utility.raise_error;
138 End lck;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |-----------------------------< convert_args >-----------------------------|
142 -- ----------------------------------------------------------------------------
143 Function convert_args
144 (
145 p_agreement_id in number,
146 p_person_id in number,
147 p_name in varchar2,
148 p_description in varchar2,
149 p_agreement_number in varchar2,
150 p_agreement_start_date in date,
151 p_agreement_end_date in date,
152 p_status in varchar2,
153 p_seta in varchar2,
154 p_probationary_end_date in date,
155 p_terminated_by in varchar2,
156 p_learner_type in varchar2,
157 p_reason_for_termination in varchar2,
158 p_actual_end_date in date,
159 p_agreement_hard_copy_id in number
160 )
161 Return g_za_rec_type is
162 --
163 l_rec g_za_rec_type;
164 l_proc varchar2(72) := g_package||'convert_args';
165 --
166 Begin
167 --
168 hr_utility.set_location('Entering:'||l_proc, 5);
169 --
170 -- Convert arguments into local l_rec structure.
171 --
172 l_rec.agreement_id := p_agreement_id;
173 l_rec.person_id := p_person_id;
174 l_rec.name := p_name;
175 l_rec.description := p_description;
176 l_rec.agreement_number := p_agreement_number;
177 l_rec.probationary_end_date := p_probationary_end_date;
178 l_rec.agreement_start_date := p_agreement_start_date;
179 l_rec.agreement_end_date := p_agreement_end_date;
180 l_rec.actual_end_date := p_actual_end_date;
181 l_rec.SETA := p_seta;
182 l_rec.learner_type := p_learner_type;
183 l_rec.status := p_status;
184 l_rec.terminated_by := p_terminated_by;
185 l_rec.reason_for_termination := p_reason_for_termination;
186 l_rec.agreement_hard_copy_id := p_agreement_hard_copy_id;
187
188 --
189 -- Return the plsql record structure.
190 --
191 hr_utility.set_location(' Leaving:'||l_proc, 10);
192 Return(l_rec);
193 --
194 End convert_args;
195 --
196 end per_za_lsa_shd;