[Home] [Help]
PACKAGE BODY: APPS.CHV_CREATE_BUCKETS
Source
1 PACKAGE BODY CHV_CREATE_BUCKETS as
2 /* $Header: CHVCBKTB.pls 120.2.12020000.2 2013/02/10 22:22:35 vegajula ship $*/
3 /*========================== CHV_CREATE_BUCKETS ==============================*/
4 /*=============================================================================
5
6 PROCEDURE NAME: create_bucket_template()
7
8 =============================================================================*/
9
10 PROCEDURE create_bucket_template(
11 p_horizon_start_date IN DATE,
12 p_include_future_release_flag IN VARCHAR2,
13 p_bucket_pattern_id IN NUMBER,
14 p_horizon_end_date OUT NOCOPY DATE,
15 x_bucket_descriptor_table IN OUT NOCOPY BKTTABLE,
16 x_bucket_start_date_table IN OUT NOCOPY BKTTABLE,
17 x_bucket_end_date_table IN OUT NOCOPY BKTTABLE) IS
18
19 /* Declare Program Variables */
20
21 x_progress varchar2(3) := NULL ;
22 x_week_start_day varchar2(25) ;
23 x_day_count number := 0 ;
24 x_week_count number := 0 ;
25 x_month_count number := 0 ;
26 x_quarter_count number := 0 ;
27
28 x_bucket_start_date date := p_horizon_start_date ;
29 x_bucket_end_date date := p_horizon_start_date ;
30 x_horizon_end_date date ;
31 x_bucket_count number := 1 ;
32
33 begin
34
35 x_progress := '010' ;
36
37 /* Select the bucket pattern from chv_bucket_patterns based on
38 ** incoming parameter bucket_pattern_id including the week
39 ** start day.
40 ** We have to hardcode the date due to nls issue when using the next_day function. We have to use
41 ** a known date to get the correct 3 char day in the current language.
42 */
43
44 SELECT decode(cbp.week_start_day,'1_MONDAY' , to_char(to_date('31/01/2000','DD/MM/YYYY'),'DY'),
45 '2_TUESDAY' , to_char(to_date('01/02/2000','DD/MM/YYYY'),'DY'),
46 '3_WEDNESDAY' , to_char(to_date('02/02/2000','DD/MM/YYYY'),'DY'),
47 '4_THURSDAY' , to_char(to_date('03/02/2000','DD/MM/YYYY'),'DY'),
48 '5_FRIDAY' , to_char(to_date('04/02/2000','DD/MM/YYYY'),'DY'),
49 '6_SATURDAY' , to_char(to_date('05/02/2000','DD/MM/YYYY'),'DY'),
50 '7_SUNDAY' , to_char(to_date('06/02/2000','DD/MM/YYYY'),'DY'),
51 to_char(to_date('31/01/2000','DD/MM/YYYY'),'DY')
52 ),
53 cbp.number_daily_buckets,
54 cbp.number_weekly_buckets,
55 cbp.number_monthly_buckets,
56 cbp.number_quarterly_buckets
57 INTO x_week_start_day,
58 x_day_count,
59 x_week_count,
60 x_month_count,
61 x_quarter_count
62 FROM chv_bucket_patterns cbp
63 WHERE cbp.bucket_pattern_id = p_bucket_pattern_id;
64
65 /* Creating a Past Due bucket with just the end date
66 ** which is the day before the horizon start date.
67 */
68
69 x_bucket_descriptor_table(x_bucket_count) := 'PAST_DUE' ;
70 x_bucket_start_date_table(x_bucket_count) := null ;
71 x_bucket_end_date_table(x_bucket_count) := to_char(x_bucket_start_date - 1,'YYYY/MM/DD') ;
72 x_bucket_count := x_bucket_count + 1 ;
73
74 /* Create daily buckets only if the input parameter x_day_count is
75 ** greater than 0.
76 */
77
78 if x_day_count > 0 then
79
80 for i in 1..x_day_count loop
81
82 x_bucket_descriptor_table(x_bucket_count) := 'DAY' ;
83 x_bucket_start_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
84 x_bucket_end_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
85 x_bucket_count := x_bucket_count + 1 ;
86 x_bucket_end_date := x_bucket_start_date ;
87 x_bucket_start_date := x_bucket_start_date + 1 ;
88
89 end loop ;
90
91 end if ;
92
93 /* Create the week bucket. If the bucket being created does not start on the
94 ** week_start_day specified for the organization schedule being created
95 ** create a buffer bucket to fill the gap.
96 */
97
98 if x_week_count > 0 then
99
100 if next_day(x_bucket_start_date,x_week_start_day)<>
101 (x_bucket_start_date + 7) then
102
103 x_bucket_descriptor_table(x_bucket_count) := 'BUFFER' ;
104 x_bucket_start_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
105 x_bucket_end_date_table(x_bucket_count) := to_char(next_day(x_bucket_start_date,x_week_start_day) - 1,'YYYY/MM/DD') ;
106 x_bucket_start_date := next_day(x_bucket_start_date,x_week_start_day) ;
107 x_bucket_end_date := next_day(x_bucket_start_date,x_week_start_day) ;
108 x_bucket_count := x_bucket_count + 1 ;
109
110 end if ;
111
112 for i in 1..x_week_count loop
113
114 x_bucket_descriptor_table(x_bucket_count) := 'WEEK' ;
115 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD');
116 x_bucket_end_date_table(x_bucket_count) := to_char((x_bucket_start_date + 6),'YYYY/MM/DD');
117 x_bucket_start_date := x_bucket_start_date + 7 ;
118 x_bucket_end_date := x_bucket_start_date - 1 ;
119 x_bucket_count := x_bucket_count + 1 ;
120
121 end loop ;
122
123 end if ;
124
125 /* Create Month buckets. If the previous bucket does not end on the last
126 ** day of the month create a buffer bucket to fill the gap so that the
127 ** month starts on the first of the calender month.
128 */
129
130 if x_month_count > 0 then
131
132 if last_day(x_bucket_start_date - 1) - (x_bucket_start_date - 1) <> 0 then
133
134 x_bucket_descriptor_table(x_bucket_count) := 'BUFFER' ;
135 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD');
136 x_bucket_end_date_table(x_bucket_count) := to_char(last_day(x_bucket_start_date),'YYYY/MM/DD') ;
137 x_bucket_start_date := last_day(x_bucket_start_date) + 1;
138 x_bucket_end_date := last_day(x_bucket_start_date) ;
139 x_bucket_count := x_bucket_count + 1 ;
140
141 end if ;
142
143 for i in 1..x_month_count loop
144
145 x_bucket_descriptor_table(x_bucket_count) := 'MONTH' ;
146 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD') ;
147 x_bucket_end_date_table(x_bucket_count) := to_char(last_day(x_bucket_start_date),'YYYY/MM/DD') ;
148 x_bucket_start_date := last_day(x_bucket_start_date) + 1 ;
149 x_bucket_end_date := x_bucket_start_date - 1 ;
150 x_bucket_count := x_bucket_count + 1 ;
151
152 end loop ;
153
154 end if ;
155
156 /* Create Quarter buckets. If the previous bucket does not end on the last
157 ** day of the month create a buffer bucket to fill the gap so that the
158 ** quarter starts on the first of the calender month.
159 */
160
161 if x_quarter_count > 0 then
162
163 if last_day(x_bucket_start_date-1) - (x_bucket_start_date-1) <> 0 then
164
165 x_bucket_descriptor_table(x_bucket_count) := 'BUFFER' ;
166 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD') ;
167 x_bucket_end_date_table(x_bucket_count) := to_char(last_day(x_bucket_start_date),'YYYY/MM/DD') ;
168 x_bucket_start_date := last_day(x_bucket_start_date) + 1 ;
169 x_bucket_end_date := x_bucket_start_date - 1 ;
170 x_bucket_count := x_bucket_count + 1 ;
171
172 end if ;
173
174 for i in 1..x_quarter_count loop
175
176 x_bucket_descriptor_table(x_bucket_count) := 'QUARTER' ;
177 x_bucket_start_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
178 x_bucket_end_date_table(x_bucket_count) := to_char(add_months((x_bucket_start_date-1),3),'YYYY/MM/DD') ;
179 x_bucket_start_date := add_months(x_bucket_start_date,3) ;
180 x_bucket_end_date := x_bucket_start_date - 1 ;
181 x_bucket_count := x_bucket_count + 1 ;
182
183 end loop ;
184
185 end if ;
186
187 /* Initializing the horizon end date to passed later to the calling
188 ** program
189 */
190
191 /* Assign out parameters to pass to the calling program */
192
193 p_horizon_end_date := x_bucket_end_date ;
194
195 /* Creating future release bucket if future release flag is Yes. */
196
197 If p_include_future_release_flag = 'Y' then
198
199 x_bucket_descriptor_table(x_bucket_count) := 'FUTURE' ;
200 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_end_date + 1),'YYYY/MM/DD') ;
201 x_bucket_end_date_table(x_bucket_count) := null ;
202 x_bucket_count := x_bucket_count + 1 ;
203
204 end if ;
205
206 /* Initializing the rest of the 110 buckets to null.
207 ** This has to be done because the insert_buckets program will fail
208 ** since the PL/SQL tables are transposed into a record and a hard code
209 ** insert is done.
210 */
211
212 for i in x_bucket_count..60 loop
213
214 x_bucket_descriptor_table(x_bucket_count) := null ;
215 x_bucket_start_date_table(x_bucket_count) := null ;
216 x_bucket_end_date_table(x_bucket_count) := null ;
217 x_bucket_count := x_bucket_count + 1 ;
218
219 end loop ;
220
221
222 exception
223 when others then
224 po_message_s.sql_error('Insert_Row', X_progress, sqlcode);
225 raise;
226
227 END create_bucket_template ;
228
229 /*=============================================================================
230
231 PROCEDURE NAME: load_horizontal_schedules()
232
233 =============================================================================*/
234
235 PROCEDURE load_horizontal_schedules(
236 p_schedule_id IN NUMBER,
237 p_schedule_item_id IN NUMBER,
238 p_row_select_order IN NUMBER,
239 p_row_type IN VARCHAR2,
240 p_bucket_table IN BKTTABLE) IS
241
242 x_progress varchar2(3) := NULL ;
243 x_last_updated_by NUMBER ;
244 x_login_id NUMBER ;
245
246 begin
247
248 x_login_id := fnd_global.login_id ;
249 x_last_updated_by := fnd_global.user_id ;
250
251 x_progress := '010' ;
252
253 /* Insert the record type into the table */
254
255 insert into chv_horizontal_schedules
256 (SCHEDULE_ID,
257 SCHEDULE_ITEM_ID,
258 ROW_SELECT_ORDER,
259 ROW_TYPE,
260 LAST_UPDATE_DATE,
261 LAST_UPDATED_BY,
262 CREATION_DATE,
263 CREATED_BY,
264 COLUMN1,
265 COLUMN2,
266 COLUMN3,
267 COLUMN4,
268 COLUMN5,
269 COLUMN6,
270 COLUMN7,
271 COLUMN8,
272 COLUMN9,
273 COLUMN10,
274 COLUMN11,
275 COLUMN12,
276 COLUMN13,
277 COLUMN14,
278 COLUMN15,
279 COLUMN16,
280 COLUMN17,
281 COLUMN18,
282 COLUMN19,
283 COLUMN20,
284 COLUMN21,
285 COLUMN22,
286 COLUMN23,
287 COLUMN24,
288 COLUMN25,
289 COLUMN26,
290 COLUMN27,
291 COLUMN28,
292 COLUMN29,
293 COLUMN30,
294 COLUMN31,
295 COLUMN32,
296 COLUMN33,
297 COLUMN34,
298 COLUMN35,
299 COLUMN36,
300 COLUMN37,
301 COLUMN38,
302 COLUMN39,
303 COLUMN40,
304 COLUMN41,
305 COLUMN42,
306 COLUMN43,
307 COLUMN44,
308 COLUMN45,
309 COLUMN46,
310 COLUMN47,
311 COLUMN48,
312 COLUMN49,
313 COLUMN50,
314 COLUMN51,
315 COLUMN52,
316 COLUMN53,
317 COLUMN54,
318 COLUMN55,
319 COLUMN56,
320 COLUMN57,
321 COLUMN58,
322 COLUMN59,
323 COLUMN60,
324 LAST_UPDATE_LOGIN,
325 REQUEST_ID,
326 PROGRAM_APPLICATION_ID,
327 PROGRAM_ID,
328 PROGRAM_UPDATE_DATE)
329 VALUES(p_schedule_id,
330 p_schedule_item_id,
331 p_row_select_order,
332 p_row_type,
333 sysdate,
334 x_last_updated_by,
335 sysdate,
336 x_last_updated_by,
337 p_bucket_table(1),
338 p_bucket_table(2),
339 p_bucket_table(3),
340 p_bucket_table(4),
341 p_bucket_table(5),
342 p_bucket_table(6),
343 p_bucket_table(7),
344 p_bucket_table(8),
345 p_bucket_table(9),
346 p_bucket_table(10),
347 p_bucket_table(11),
348 p_bucket_table(12),
349 p_bucket_table(13),
350 p_bucket_table(14),
351 p_bucket_table(15),
352 p_bucket_table(16),
356 p_bucket_table(20),
353 p_bucket_table(17),
354 p_bucket_table(18),
355 p_bucket_table(19),
357 p_bucket_table(21),
358 p_bucket_table(22),
359 p_bucket_table(23),
360 p_bucket_table(24),
361 p_bucket_table(25),
362 p_bucket_table(26),
363 p_bucket_table(27),
364 p_bucket_table(28),
365 p_bucket_table(29),
366 p_bucket_table(30),
367 p_bucket_table(31),
368 p_bucket_table(32),
369 p_bucket_table(33),
370 p_bucket_table(34),
371 p_bucket_table(35),
372 p_bucket_table(36),
373 p_bucket_table(37),
374 p_bucket_table(38),
375 p_bucket_table(39),
376 p_bucket_table(40),
377 p_bucket_table(41),
378 p_bucket_table(42),
379 p_bucket_table(43),
380 p_bucket_table(44),
381 p_bucket_table(45),
382 p_bucket_table(46),
383 p_bucket_table(47),
384 p_bucket_table(48),
385 p_bucket_table(49),
386 p_bucket_table(50),
387 p_bucket_table(51),
388 p_bucket_table(52),
389 p_bucket_table(53),
390 p_bucket_table(54),
391 p_bucket_table(55),
392 p_bucket_table(56),
393 p_bucket_table(57),
394 p_bucket_table(58),
395 p_bucket_table(59),
396 p_bucket_table(60),
397 x_login_id,
398 null,
399 null,
400 null,
401 null ) ;
402 exception
403 when others then
404 po_message_s.sql_error('Insert_Row', X_progress, sqlcode);
405 raise;
406
407 END load_horizontal_schedules ;
408 /*=============================================================================
409
410 PROCEDURE NAME: calculate_bucket_qty()
411
412 =============================================================================*/
413 PROCEDURE calculate_buckets(p_schedule_id IN NUMBER,
414 p_schedule_item_id IN NUMBER,
415 p_horizon_start_date IN DATE,
416 p_horizon_end_date IN DATE,
417 p_schedule_type IN VARCHAR2,
418 p_cum_enable_flag IN VARCHAR2,
419 p_cum_quantity_received IN NUMBER,
420 p_bucket_descriptor_table IN BKTTABLE,
421 p_bucket_start_date_table IN BKTTABLE,
422 p_bucket_end_date_table IN BKTTABLE,
423 p_past_due_qty OUT NOCOPY NUMBER,
424 p_past_due_qty_primary OUT NOCOPY NUMBER
425 ) IS
426
427 /* Declaring Program Variables */
428
429 x_release_quantity_table bkttable ;
430 x_forecast_quantity_table bkttable ;
431 x_cum_quantity_table bkttable ;
432 x_total_quantity_table bkttable ;
433
434 x_bucket_count number := 0 ;
435 x_forecast_quantity number := 0 ;
436 x_total_forecast_qty number := 0 ;
437 x_release_quantity number := 0 ;
438 x_total_release_qty number := 0 ;
439 x_release_quantity_primary number := 0 ;
440
441 x_row_select_order number ;
442 x_row_type varchar2(25) ;
443 x_progress varchar2(25) ;
444
445 BEGIN
446
447 x_progress := '010' ;
448
449 /*new code starts*/
450
451
452 if p_bucket_descriptor_table(1) = 'PAST_DUE' then
453
454 /* Calculate Past Due Bucket Quantity by selecting
455 ** total ORDER_QUANTITY from CHV_ITEM_ORDERS
456 ** based on the due_date.
457 */
458
459 begin
460
461 x_progress := '020' ;
462
463 select nvl(sum(round(cio.order_quantity,5)),0),
464 nvl(sum(round(cio.order_quantity_primary,5)),0)
465 into p_past_due_qty,
466 p_past_due_qty_primary
467 from chv_item_orders cio
468 where cio.schedule_id = p_schedule_id
469 and cio.schedule_item_id = p_schedule_item_id
470 and cio.supply_document_type = 'RELEASE'
471 and trunc(cio.due_date) <= to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD') ;
472
473 exception when no_data_found then null ;
474 end ;
475
476 END IF;
477
478 FORALL x_bucket_count IN 1..60
479
480 insert into po_session_gt
481 (num1,
482 num2 )
483 select nvl(sum(round(cio.order_quantity,5)),0) release_quantity,
484 0 forecast_quantity
485 from chv_item_orders cio
486 where cio.schedule_id = p_schedule_id
487 and cio.schedule_item_id = p_schedule_item_id
488 and cio.supply_document_type = 'RELEASE'
489 and trunc(cio.due_date) <= to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD')
490 AND p_bucket_descriptor_table(x_bucket_count) = 'PAST_DUE'
491 UNION ALL
492 SELECT Nvl(SUM(release_qty),0) release_quantity,Nvl(SUM(forecast_qty),0) forecast_quantity
493 FROM
494 (SELECT DECODE (
495 cio.supply_document_type,
496 'RELEASE',
497 DECODE (p_schedule_type,
498 'FORECAST_ALL_DOCUMENTS', 0,
499 'FORECAST_ONLY', 0,
500 NVL (ROUND (cio.order_quantity, 5), 0))
501 ) release_qty,
502 DECODE (
503 cio.supply_document_type,
504 'RELEASE',
505 DECODE (p_schedule_type,
506 'FORECAST_ALL_DOCUMENTS',
510 'RELEASE_ONLY',0 ,
507 NVL (ROUND (cio.order_quantity, 5), 0),
508 0),
509 DECODE (p_schedule_type,
511 'FORECAST_ALL_DOCUMENTS', 0,
512 NVL (ROUND (cio.order_quantity, 5), 0))
513 )forecast_qty
514 FROM chv_item_orders cio
515 WHERE cio.schedule_id = p_schedule_id
516 and cio.schedule_item_id = p_schedule_item_id
517 and cio.supply_document_type IN ('RELEASE', 'PLANNED_ORDER', 'REQUISITION')
518 AND p_schedule_type IN ('FORECAST_ALL_DOCUMENTS','FORECAST_ONLY','MATERIAL_RELEASE', 'RELEASE_WITH_FORECAST','RELEASE_ONLY')
519 and trunc(cio.due_date) between to_date(p_bucket_start_date_table(x_bucket_count),'YYYY/MM/DD')
520 AND to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD')
521 and p_bucket_descriptor_table(x_bucket_count) in ('DAY','BUFFER','WEEK','MONTH','QUARTER') )
522 union all
523 SELECT
524 nvl(sum(round(cio.order_quantity,5)),0) release_quantity ,
525 0 forecast_quantity
526 from chv_item_orders cio
527 where cio.schedule_id = p_schedule_id
528 and cio.schedule_item_id = p_schedule_item_id
529 and cio.supply_document_type = 'RELEASE'
530 and trunc(cio.due_date) > to_date(p_bucket_start_date_table(x_bucket_count),'YYYY/MM/DD')
531 and p_bucket_descriptor_table(x_bucket_count) = 'FUTURE' ;
532
533 -- num3 total_quantity = release_quantity+forecast_quantity
534 --Calculating total_quantity TABLE = release_quantity + forecast_quantity
535 update po_session_gt
536 set num3 = Nvl(num1,0)+ Nvl(num2,0);
537
538 --calculating cumulative quantity
539 update po_session_gt psg1
540 SET num4 = (SELECT
541 SUM(SUM(num1)) OVER
542 (ORDER BY rowid ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
543 +
544 SUM(SUM(num2)) OVER
545 (ORDER BY rowid ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
546 +
547 nvl(p_cum_quantity_received,0)
548 FROM po_session_gt psg2
549 where psg1.rowid= psg2.rowid
550 GROUP BY psg2.rowid
551 );
552
553
554
555 select num1,/*release+_quantity_table*/
556 num2,/*forecast_quantity_table*/
557 num3/*total_quantity_table*/,
558 num4/*cum_quantity_table*/
559 bulk collect into x_release_quantity_table
560 ,x_forecast_quantity_table
561 ,x_total_quantity_table
562 ,x_cum_quantity_table
563 from po_session_gt;
564
565 -- deleting the data frmo po_session_gt.
566 DELETE FROM po_session_gt;
567
568 /*new code ends*/
569
570 /* Initialize row_select_order and row_type and call stored
571 ** procedure insert_buckets by passing the appropriate PL/SQL table
572 ** to insert the record into CHV_HORIZONTAL_SCHEDULES
573 */
574
575 x_row_select_order := 1 ;
576 x_row_type := 'BUCKET_DESCRIPTOR' ;
577 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
578 p_schedule_item_id ,
579 x_row_select_order ,
580 x_row_type ,
581 p_bucket_descriptor_table ) ;
582
583 x_row_select_order := 2 ;
584 x_row_type := 'BUCKET_START_DATE' ;
585 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
586 p_schedule_item_id ,
587 x_row_select_order ,
588 x_row_type ,
589 p_bucket_start_date_table ) ;
590
591 x_row_select_order := 3 ;
592 x_row_type := 'RELEASE_QUANTITY' ;
593 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
594 p_schedule_item_id ,
595 x_row_select_order ,
596 x_row_type ,
597 x_release_quantity_table ) ;
598
599 x_row_select_order := 4 ;
600 x_row_type := 'FORECAST_QUANTITY' ;
601 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
602 p_schedule_item_id ,
603 x_row_select_order ,
604 x_row_type ,
605 x_forecast_quantity_table ) ;
606 x_row_select_order := 5 ;
607 x_row_type := 'TOTAL_QUANTITY' ;
608 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
609 p_schedule_item_id ,
610 x_row_select_order ,
611 x_row_type ,
612 x_total_quantity_table ) ;
613
614 x_row_select_order := 6 ;
615 x_row_type := 'CUM_QUANTITY' ;
616 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
617 p_schedule_item_id ,
618 x_row_select_order ,
619 x_row_type ,
620 x_cum_quantity_table ) ;
621
622 x_row_select_order := 7 ;
623 x_row_type := 'BUCKET_END_DATE' ;
624 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
625 p_schedule_item_id ,
626 x_row_select_order ,
627 x_row_type ,
628 p_bucket_end_date_table ) ;
629 exception
630 when others then
631 po_message_s.sql_error('calculate_bucket_qty', X_progress, sqlcode);
632 raise;
633
634 END calculate_buckets ;
635
636 END CHV_CREATE_BUCKETS ;