[Home] [Help]
PACKAGE BODY: APPS.PAY_JP_SWOT_NUMBERS_PKG
Source
1 PACKAGE BODY PAY_JP_SWOT_NUMBERS_PKG AS
2 /* $Header: pyjppswn.pkb 120.1 2005/10/19 20:30:17 hikubo noship $ */
3 --
4 -------------------------------------------------------------------------------
5 -- INSERT ROW
6 --
7 -- To insert a row into PAY_JP_SWOT_NUMBERS from PAYJPSWN.fmx
8 --
9 -------------------------------------------------------------------------------
10 PROCEDURE insert_row
11 (
12 x_rowid in out nocopy varchar2,
13 x_organization_id in number,
14 x_district_code in varchar2,
15 x_report_district_code in varchar2,
16 x_swot_number in varchar2,
17 x_last_update_date in date,
18 x_last_updated_by in number,
19 x_last_update_login in number,
20 x_created_by in number,
21 x_creation_date in date
22 )IS
23 --
24 cursor cur_row is
25 select rowidtochar(rowid)
26 from pay_jp_swot_numbers
27 where organization_id = x_organization_id
28 and district_code = x_district_code;
29 --
30 BEGIN
31 --
32 insert into pay_jp_swot_numbers
33 (
34 organization_id,
35 district_code,
36 report_district_code,
37 swot_number,
38 last_update_date,
39 last_updated_by,
40 last_update_login,
41 created_by,
42 creation_date
43 )
44 values
45 (
46 x_organization_id,
47 x_district_code,
48 x_report_district_code,
49 x_swot_number,
50 x_last_update_date,
51 x_last_updated_by,
52 x_last_update_login,
53 x_created_by,
54 x_creation_date
55 );
56 --
57 open cur_row;
58 fetch cur_row into x_rowid;
59 --
60 if (cur_row%NOTFOUND) then
61 close cur_row;
62 raise NO_DATA_FOUND;
63 end if;
64 --
65 close cur_row;
66 --
67 END insert_row;
68 --
69 -------------------------------------------------------------------------------
70 -- LOCK ROW
71 --
72 -- To lock row of PAY_JP_SWOT_NUMBERS from PAYJPSWN.fmx
73 --
74 -------------------------------------------------------------------------------
75 PROCEDURE lock_row
76 (
77 x_rowid in varchar2,
78 x_organization_id in number,
79 x_district_code in varchar2,
80 x_report_district_code in varchar2,
81 x_swot_number in varchar2,
82 x_last_update_date in date,
83 x_last_updated_by in number,
84 x_last_update_login in number,
85 x_created_by in number,
86 x_creation_date in date
87 )IS
88 --
89 cursor cur_row is
90 select
91 organization_id,
92 district_code,
93 report_district_code,
94 swot_number,
95 last_update_date,
96 last_updated_by,
97 last_update_login,
98 created_by,
99 creation_date
100 from
101 pay_jp_swot_numbers
102 where
103 rowid = chartorowid(x_rowid)
104 for update of
105 organization_id,
106 district_code,
107 report_district_code,
108 swot_number
109 nowait;
110 --
111 l_cur_row cur_row%ROWTYPE;
112 --
113 BEGIN
114 --
115 open cur_row;
116 fetch cur_row into l_cur_row;
117 --
118 if (cur_row%NOTFOUND) then
119 close cur_row;
120 fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
121 app_exception.raise_exception;
122 end if;
123 --
124 if
125 l_cur_row.organization_id = x_organization_id
126 and
127 l_cur_row.district_code = x_district_code
128 and
129 (
130 l_cur_row.report_district_code = x_report_district_code
131 or
132 (
133 l_cur_row.report_district_code is null
134 and
135 x_report_district_code is null
136 )
137 )
138 and
139 (
140 l_cur_row.swot_number = x_swot_number
141 or
142 (
143 l_cur_row.swot_number is null
144 and
145 x_swot_number is null
146 )
147 )
148 and
149 l_cur_row.last_update_date = x_last_update_date
150 and
151 l_cur_row.last_updated_by = x_last_updated_by
152 and
153 (
154 l_cur_row.last_update_login = x_last_update_login
155 or
156 (
157 l_cur_row.last_update_login is null
158 and
159 x_last_update_login is null
160 )
161 )
162 and
163 l_cur_row.created_by = x_created_by
164 and
165 l_cur_row.creation_date = x_creation_date
166 then
167 return;
168 else
169 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
170 app_exception.raise_exception;
171 end if;
172 --
173 END lock_row;
174 --
175 -------------------------------------------------------------------------------
176 -- UPDATE ROW
177 --
178 -- To update row of PAY_JP_SWOT_NUMBERS from PAYJPSWN.fmx
179 --
180 -------------------------------------------------------------------------------
181 PROCEDURE update_row
182 (
183 x_rowid in varchar2,
184 x_organization_id in number,
185 x_district_code in varchar2,
186 x_report_district_code in varchar2,
187 x_swot_number in varchar2,
188 x_last_update_date in date,
189 x_last_updated_by in number,
190 x_last_update_login in number,
191 x_created_by in number,
192 x_creation_date in date
193 )IS
194 BEGIN
195 --
196 update
197 pay_jp_swot_numbers
198 set
199 organization_id = x_organization_id,
200 district_code = x_district_code,
201 report_district_code = x_report_district_code,
202 swot_number = x_swot_number,
203 last_update_date = x_last_update_date,
204 last_updated_by = x_last_updated_by,
205 last_update_login = x_last_update_login,
206 created_by = x_created_by,
207 creation_date = x_creation_date
208 where
209 rowid = chartorowid(x_rowid);
210 --
211 if (SQL%NOTFOUND) then
212 raise NO_DATA_FOUND;
213 end if;
214 --
215 END update_row;
216 --
217 --------------------------------------------------------------------------------
218 -- DELETE ROW
219 --
220 -- To delete row of PAY_JP_SWOT_NUMBERS from PAYJPSWN.fmx
221 --
222 -------------------------------------------------------------------------------
223 PROCEDURE delete_row(x_rowid in varchar2)IS
224 BEGIN
225 --
226 delete from pay_jp_swot_numbers
227 where rowid = chartorowid(x_rowid);
228 --
229 if (SQL%NOTFOUND) then
230 raise NO_DATA_FOUND;
231 end if;
232 --
233 END delete_row;
234 --
235 --------------------------------------------------------------------------------
236 -- CHK SWOT NUMBER
237 --
238 -- To check swot number column length. If the column is over 15 byte length,
239 -- return False.
240 --
241 -------------------------------------------------------------------------------
242 FUNCTION chk_swot_number(p_value in VARCHAR2) return VARCHAR2 IS
243 --
244 l_length_swot_num number;
245 --
246 BEGIN
247 --
248 l_length_swot_num := lengthb(p_value);
249 --
250 if l_length_swot_num > 15 then
251 return('FALSE');
252 elsif l_length_swot_num is null then
253 return('FALSE');
254 elsif l_length_swot_num < 1 then
255 return('FALSE');
256 else
257 return('TRUE');
258 end if;
259 --
260 END chk_swot_number;
261 --
262 END PAY_JP_SWOT_NUMBERS_PKG;