DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_DST_SHD

Source


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