1 PACKAGE BODY PO_RELEASE_DELETE_S AS
2
3 /* $Header: poreldeb.pls 115.0 99/07/17 02:27:35 porting ship $ */
4
5
6 /*===========================================================================
7
8 PROCEDURE DELETE_RELEASE_UPDATE
9
10 ===========================================================================*/
11
12 PROCEDURE DELETE_RELEASE_UPDATE (X_po_release_id IN NUMBER) IS
13
14 X_line_location_id NUMBER := 0;
15 X_po_line_id NUMBER := 0;
16 X_delete_quantity NUMBER := 0;
17
18 CURSOR get_shipments IS
19 SELECT pll.line_location_id,
20 pll.po_line_id,
21 pll.quantity
22 FROM po_line_locations pll
23 WHERE pll.po_release_id = X_po_release_id;
24
25
26 BEGIN
27
28
29 OPEN get_shipments;
30
31 /* Loop through the lines and check to see how much of the contract has
32 been used up by other po's that have been created
33 */
34 LOOP
35
36 FETCH get_shipments INTO X_line_location_id,
37 X_po_line_id,
38 X_delete_quantity;
39 EXIT WHEN get_shipments%NOTFOUND;
40
41 --dbms_output.put_line('X_line_location_id = ' || X_line_location_id);
42
43
44
45 UPDATE po_lines
46 SET quantity = quantity - X_Delete_quantity
47 WHERE po_line_id = X_po_line_id;
48
49 --dbms_output.put_line('X_delete_quantity = ' || X_Delete_quantity);
50
51 END LOOP;
52
53 RETURN;
54
55 /* If something fails then return a 0 as failure */
56 EXCEPTION
57 WHEN OTHERS THEN
58 raise;
59
60 END delete_release_update;
61
62 END po_release_delete_s;