[Home] [Help]
PACKAGE BODY: APPS.PER_ZA_TRA_SHD
Source
1 Package Body per_za_tra_shd as
2 /* $Header: pezatrsh.pkb 115.0 2001/02/04 22:36:38 pkm ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_za_tra_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_tra_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_tra_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_tra_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_tra_REC_EXISTS');
47 hr_utility.raise_error;
48 ElsIf (p_constraint_name = 'PER_tra_CHK_DATES') Then
49 hr_utility.set_message(801, 'HR_51853_tra_DATE_INV');
50 hr_utility.raise_error;
51 ElsIf (p_constraint_name = 'PER_QUALIFICATIONS_PK') Then
52 hr_utility.set_message(801, 'HR_51854_tra_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 -- |---------------------------------< lck >----------------------------------|
65 -- ----------------------------------------------------------------------------
66 Procedure lck
67 (
68 p_training_id in number,
69 p_person_id in number
70 ) is
71 --
72 -- Cursor selects the 'current' row from the HR Schema
73 --
74 Cursor C_Sel1 is
75 select
76 TRAINING_ID,
77 LEVEL_ID,
78 PERSON_ID,
79 FIELD_OF_LEARNING,
80 COURSE,
81 SUB_FIELD,
82 CREDIT,
83 NOTIONAL_HOURS,
84 REGISTRATION_DATE,
85 REGISTRATION_NUMBER
86 from
87 per_za_training
88 where
89 training_id = p_training_id
90 for update nowait;
91
92 l_proc varchar2(72) := g_package||'lck';
93 --
94 Begin
95 hr_utility.set_location('Entering:'||l_proc, 5);
96 --
97 -- Add any mandatory argument checking here:
98 -- Example:
99 -- hr_api.mandatory_arg_error
100 -- (p_api_name => l_proc,
101 -- p_argument => 'object_version_number',
102 -- p_argument_value => p_object_version_number);
103 --
104 hr_api.mandatory_arg_error
105 (p_api_name => l_proc,
106 p_argument => 'training_id',
107 p_argument_value => p_training_id);
108 Open C_Sel1;
109 Fetch C_Sel1 Into g_old_rec;
110 If C_Sel1%notfound then
111 Close C_Sel1;
112 --
113 -- The primary key is invalid therefore we must error
114 --
115 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
116 hr_utility.raise_error;
117 End If;
118 Close C_Sel1;
119 --
120 hr_utility.set_location(' Leaving:'||l_proc, 10);
121 --
122 -- We need to trap the ORA LOCK exception
123 --
124 Exception
125 When HR_Api.Object_Locked then
126 --
127 -- The object is locked therefore we need to supply a meaningful
128 -- error message.
129 --
130 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
131 hr_utility.set_message_token('TABLE_NAME', 'per_za_training');
132 hr_utility.raise_error;
133 End lck;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |-----------------------------< convert_args >-----------------------------|
137 -- ----------------------------------------------------------------------------
138 Function convert_args
139 (
140 P_TRAINING_ID IN NUMBER,
141 P_LEVEL_ID IN NUMBER,
142 P_PERSON_ID IN NUMBER,
143 P_FIELD_OF_LEARNING IN VARCHAR2,
144 P_COURSE IN VARCHAR2,
145 P_SUB_FIELD IN VARCHAR2,
146 P_CREDIT IN NUMBER,
147 P_NOTIONAL_HOURS IN NUMBER,
148 P_REGISTRATION_DATE IN DATE,
149 P_REGISTRATION_NUMBER IN VARCHAR2
150 )
151 Return g_za_rec_type is
152 --
153 l_rec g_za_rec_type;
154 l_proc varchar2(72) := g_package||'convert_args';
155 --
156 Begin
157 --
158 hr_utility.set_location('Entering:'||l_proc, 5);
159 --
160 -- Convert arguments into local l_rec structure.
161 --
162 l_rec.training_id := p_training_id;
163 l_rec.level_id := p_level_id;
164 l_rec.person_id := p_person_id;
165 l_rec.field_of_learning := p_field_of_learning;
166 l_rec.course := p_course;
167 l_rec.sub_field := p_sub_field;
168 l_rec.credit := p_credit;
169 l_rec.notional_hours := p_notional_hours;
170 l_rec.registration_date := p_registration_date;
171 l_rec.registration_number := p_registration_number;
172
173 --
174 -- Return the plsql record structure.
175 --
176 hr_utility.set_location(' Leaving:'||l_proc, 10);
177 Return(l_rec);
178 --
179 End convert_args;
180 --
181 end per_za_tra_shd;