DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_STB_SHD

Source


1 Package Body per_stb_shd as
2 /* $Header: pestbrhi.pkb 115.0 2003/07/03 06:26:56 kavenkat noship $ */ --
3 -- ----------------------------------------------------------------------------
4 -- |                     Private Global Definitions                           |
5 -- ----------------------------------------------------------------------------
6 --
7 g_package  varchar2(33) := '  per_stb_shd.';  -- Global package name
8 --
9 -- ----------------------------------------------------------------------------
10 -- |---------------------------< constraint_error >---------------------------|
11 -- ----------------------------------------------------------------------------
12 Procedure constraint_error
13   (p_constraint_name in all_constraints.constraint_name%TYPE
14   ) Is
15 --
16   l_proc        varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   --
20   If (p_constraint_name = 'PER_RI_SETUP_TASKS_PK') Then
21     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
22     fnd_message.set_token('PROCEDURE', l_proc);
23     fnd_message.set_token('STEP','5');
24     fnd_message.raise_error;
25   Else
26     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
27     fnd_message.set_token('PROCEDURE', l_proc);
28     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
29     fnd_message.raise_error;
30   End If;
31   --
32 End constraint_error;
33 --
34 -- ----------------------------------------------------------------------------
35 -- |-----------------------------< api_updating >-----------------------------|
36 -- ----------------------------------------------------------------------------
37 Function api_updating
38   (p_setup_task_code                      in     varchar2
39   ,p_object_version_number                in     number
40   )
41   Return Boolean Is
42   --
43   --
44   -- Cursor selects the 'current' row from the HR Schema
45   --
46   Cursor C_Sel1 is
47     select
48        setup_task_code
49       ,workbench_item_code
50       ,setup_task_sequence
51       ,setup_task_status
52       ,setup_task_creation_date
53       ,setup_task_last_modified_date
54       ,setup_task_type
55       ,setup_task_action
56       ,object_version_number
57     from        per_ri_setup_tasks
58     where       setup_task_code = p_setup_task_code;
59   --
60   l_fct_ret     boolean;
61   --
62 Begin
63   --
64   If (p_setup_task_code is null and
65       p_object_version_number is null
66      ) Then
67     --
68     -- One of the primary key arguments is null therefore we must
69     -- set the returning function value to false
70     --
71     l_fct_ret := false;
72   Else
73     If (p_setup_task_code
74         = per_stb_shd.g_old_rec.setup_task_code and
75         p_object_version_number
76         = per_stb_shd.g_old_rec.object_version_number
77        ) Then
78       --
79       -- The g_old_rec is current therefore we must
80       -- set the returning function to true
81       --
82       l_fct_ret := true;
83     Else
84       --
85       -- Select the current row into g_old_rec
86       --
87       Open C_Sel1;
88       Fetch C_Sel1 Into per_stb_shd.g_old_rec;
89       If C_Sel1%notfound Then
90         Close C_Sel1;
91         --
92         -- The primary key is invalid therefore we must error
93         --
94         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
95         fnd_message.raise_error;
96       End If;
97       Close C_Sel1;
98       If (p_object_version_number
99           <> per_stb_shd.g_old_rec.object_version_number) Then
100         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
101         fnd_message.raise_error;
102       End If;
103       l_fct_ret := true;
104     End If;
105   End If;
106   Return (l_fct_ret);
107 --
108 End api_updating;
109 --
110 -- ----------------------------------------------------------------------------
111 -- |---------------------------------< lck >----------------------------------|
112 -- ----------------------------------------------------------------------------
113 Procedure lck
114   (p_setup_task_code                      in     varchar2
115   ,p_object_version_number                in     number
116   ) is
117 --
118 -- Cursor selects the 'current' row from the HR Schema
119 --
120   Cursor C_Sel1 is
121     select
122        setup_task_code
123       ,workbench_item_code
124       ,setup_task_sequence
125       ,setup_task_status
126       ,setup_task_creation_date
127       ,setup_task_last_modified_date
128       ,setup_task_type
129       ,setup_task_action
130       ,object_version_number
131     from        per_ri_setup_tasks
132     where       setup_task_code = p_setup_task_code
133     for update nowait;
134 --
135   l_proc        varchar2(72) := g_package||'lck';
136 --
137 Begin
138   hr_utility.set_location('Entering:'||l_proc, 5);
139   --
140   hr_api.mandatory_arg_error
141     (p_api_name           => l_proc
142     ,p_argument           => 'SETUP_TASK_CODE'
143     ,p_argument_value     => p_setup_task_code
144     );
145   hr_utility.set_location(l_proc,6);
146   hr_api.mandatory_arg_error
147     (p_api_name           => l_proc
148     ,p_argument           => 'OBJECT_VERSION_NUMBER'
149     ,p_argument_value     => p_object_version_number
150     );
151   --
152   Open  C_Sel1;
153   Fetch C_Sel1 Into per_stb_shd.g_old_rec;
154   If C_Sel1%notfound then
155     Close C_Sel1;
156     --
157     -- The primary key is invalid therefore we must error
158     --
159     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
160     fnd_message.raise_error;
161   End If;
162   Close C_Sel1;
163   If (p_object_version_number
164       <> per_stb_shd.g_old_rec.object_version_number) Then
165         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
166         fnd_message.raise_error;
167   End If;
168   --
169   hr_utility.set_location(' Leaving:'||l_proc, 10);
170   --
171   -- We need to trap the ORA LOCK exception
172   --
173 Exception
174   When HR_Api.Object_Locked then
175     --
176     -- The object is locked therefore we need to supply a meaningful
177     -- error message.
178     --
179     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
180     fnd_message.set_token('TABLE_NAME', 'per_ri_setup_tasks');
181     fnd_message.raise_error;
182 End lck;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< convert_args >-----------------------------|
186 -- ----------------------------------------------------------------------------
187 Function convert_args
188   (p_setup_task_code                in varchar2
189   ,p_workbench_item_code            in varchar2
190   ,p_setup_task_sequence            in number
191   ,p_setup_task_status              in varchar2
192   ,p_setup_task_creation_date       in date
193   ,p_setup_task_last_modified_dat   in date
194   ,p_setup_task_type                in varchar2
195   ,p_setup_task_action              in varchar2
196   ,p_object_version_number          in number
197   )
198   Return g_rec_type is
199 --
200   l_rec   g_rec_type;
201 --
202 Begin
203   --
204   -- Convert arguments into local l_rec structure.
205   --
206   l_rec.setup_task_code                  := p_setup_task_code;
207   l_rec.workbench_item_code              := p_workbench_item_code;
208   l_rec.setup_task_sequence              := p_setup_task_sequence;
209   l_rec.setup_task_status                := p_setup_task_status;
210   l_rec.setup_task_creation_date         := p_setup_task_creation_date;
211   l_rec.setup_task_last_modified_date    := p_setup_task_last_modified_dat;
212   l_rec.setup_task_type                  := p_setup_task_type;
213   l_rec.setup_task_action                := p_setup_task_action;
214   l_rec.object_version_number            := p_object_version_number;
215   --
216   -- Return the plsql record structure.
217   --
218   Return(l_rec);
219 --
220 End convert_args;
221 --
222 end per_stb_shd;