[Home] [Help]
PACKAGE BODY: APPS.HR_PAT_SHD
Source
1 Package Body hr_pat_shd as
2 /* $Header: hrpatrhi.pkb 115.2 99/07/17 05:36:40 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_pat_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 = 'HR_PAT_START_TIME') Then
37 hr_utility.set_message(801, 'HR_51080_GEN_HH24MI_FORMAT');
38 elsif (p_constraint_name = 'HR_PAT_UK01') Then
39 hr_utility.set_message (801,'HR_51081_PAT_UK01');
40 Else
41 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
42 hr_utility.set_message_token('PROCEDURE', l_proc);
43 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
44 hr_utility.raise_error;
45 End If;
46 --
47 hr_utility.raise_error;
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (
56 p_pattern_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 pattern_id,
66 pattern_name,
67 pattern_start_weekday,
68 pattern_start_time,
69 object_version_number
70 from hr_patterns
71 where pattern_id = p_pattern_id;
72 --
73 l_proc varchar2(72) := g_package||'api_updating';
74 l_fct_ret boolean;
75 --
76 Begin
77 hr_utility.set_location('Entering:'||l_proc, 5);
78 --
79 If (
80 p_pattern_id is null and
81 p_object_version_number is null
82 ) Then
83 --
84 -- One of the primary key arguments is null therefore we must
85 -- set the returning function value to false
86 --
87 l_fct_ret := false;
88 Else
89 If (
90 p_pattern_id = g_old_rec.pattern_id and
91 p_object_version_number = g_old_rec.object_version_number
92 ) Then
93 hr_utility.set_location(l_proc, 10);
94 --
95 -- The g_old_rec is current therefore we must
96 -- set the returning function to true
97 --
98 l_fct_ret := true;
99 Else
100 --
101 -- Select the current row into g_old_rec
102 --
103 Open C_Sel1;
104 Fetch C_Sel1 Into g_old_rec;
105 If C_Sel1%notfound Then
106 Close C_Sel1;
107 --
108 -- The primary key is invalid therefore we must error
109 --
110 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
111 hr_utility.raise_error;
112 End If;
113 Close C_Sel1;
114 If (p_object_version_number <> g_old_rec.object_version_number) Then
115 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
116 hr_utility.raise_error;
117 End If;
118 hr_utility.set_location(l_proc, 15);
119 l_fct_ret := true;
120 End If;
121 End If;
122 hr_utility.set_location(' Leaving:'||l_proc, 20);
123 Return (l_fct_ret);
124 --
125 End api_updating;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |---------------------------------< lck >----------------------------------|
129 -- ----------------------------------------------------------------------------
130 Procedure lck
131 (
132 p_pattern_id in number,
133 p_object_version_number in number
134 ) is
135 --
136 -- Cursor selects the 'current' row from the HR Schema
137 --
138 Cursor C_Sel1 is
139 select pattern_id,
140 pattern_name,
141 pattern_start_weekday,
142 pattern_start_time,
143 object_version_number
144 from hr_patterns
145 where pattern_id = p_pattern_id
146 for update nowait;
147 --
148 l_proc varchar2(72) := g_package||'lck';
149 --
150 Begin
151 hr_utility.set_location('Entering:'||l_proc, 5);
152 --
153 -- Add any mandatory argument checking here:
154 -- Example:
155 -- hr_api.mandatory_arg_error
156 -- (p_api_name => l_proc,
157 -- p_argument => 'object_version_number',
158 -- p_argument_value => p_object_version_number);
159 --
160 Open C_Sel1;
161 Fetch C_Sel1 Into g_old_rec;
162 If C_Sel1%notfound then
163 Close C_Sel1;
164 --
165 -- The primary key is invalid therefore we must error
166 --
167 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
168 hr_utility.raise_error;
169 End If;
170 Close C_Sel1;
171 If (p_object_version_number <> g_old_rec.object_version_number) Then
172 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
173 hr_utility.raise_error;
174 End If;
175 --
176 hr_utility.set_location(' Leaving:'||l_proc, 10);
177 --
178 -- We need to trap the ORA LOCK exception
179 --
180 Exception
181 When HR_Api.Object_Locked then
182 --
183 -- The object is locked therefore we need to supply a meaningful
184 -- error message.
185 --
186 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
187 hr_utility.set_message_token('TABLE_NAME', 'hr_patterns');
188 hr_utility.raise_error;
189 End lck;
190 --
191 -- ----------------------------------------------------------------------------
192 -- |-----------------------------< convert_args >-----------------------------|
193 -- ----------------------------------------------------------------------------
194 Function convert_args
195 (
196 p_pattern_id in number,
197 p_pattern_name in varchar2,
198 p_pattern_start_weekday in varchar2,
199 p_pattern_start_time in varchar2,
200 p_object_version_number in number
201 )
202 Return g_rec_type is
203 --
204 l_rec g_rec_type;
205 l_proc varchar2(72) := g_package||'convert_args';
206 --
207 Begin
208 --
209 hr_utility.set_location('Entering:'||l_proc, 5);
210 --
211 -- Convert arguments into local l_rec structure.
212 --
213 l_rec.pattern_id := p_pattern_id;
214 l_rec.pattern_name := p_pattern_name;
215 l_rec.pattern_start_weekday := p_pattern_start_weekday;
216 l_rec.pattern_start_time := p_pattern_start_time;
217 l_rec.object_version_number := p_object_version_number;
218 --
219 -- Return the plsql record structure.
220 --
221 hr_utility.set_location(' Leaving:'||l_proc, 10);
222 Return(l_rec);
223 --
224 End convert_args;
225 --
226 end hr_pat_shd;