DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SLT_SHD

Source


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