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