[Home] [Help]
PACKAGE BODY: APPS.POA_OLTP_GENERIC_PKG
Source
1 PACKAGE BODY POA_OLTP_GENERIC_PKG AS
2 /* $Header: poagpksb.pls 115.3 2002/09/05 01:47:20 jhou noship $ */
3
4 -- Global variables to cache some values to improve performance
5 g_creation_date DATE := NUll;
6 g_poh_id NUMBER := NUll;
7 g_poh_approved_date DATE := NUll;
8 g_por_id NUMBER := NUll;
9 g_por_approved_date DATE := NUll;
10 g_line_location_id NUMBER := NUll;
11 g_pll_approved_date DATE := NUll;
12
13
14 FUNCTION get_approved_date_poh (p_creation_date IN DATE,
15 p_poh_id IN NUMBER) return DATE IS
16 app_date DATE;
17
18 BEGIN
19
20 IF (p_creation_date = g_creation_date AND
21 p_poh_id = g_poh_id) THEN
22 return g_poh_approved_date;
23 END IF;
24
25 select min(approved_date)
26 into app_date
27 from po_headers_archive_all poh
28 where poh.po_header_id = p_poh_id
29 and poh.approved_date >= p_creation_date;
30
31 g_poh_approved_date := app_date;
32 g_creation_date := p_creation_date;
33 g_poh_id := p_poh_id;
34
35 return app_date;
36 END get_approved_date_poh;
37
38 FUNCTION get_approved_date_por (p_creation_date IN DATE,
39 p_por_id IN NUMBER) return DATE IS
40 app_date DATE;
41
42 BEGIN
43
44 IF (p_creation_date = g_creation_date AND
45 p_por_id = g_por_id) THEN
46 return g_por_approved_date;
47 END IF;
48
49 select min(approved_date)
50 into app_date
51 from po_releases_archive_all por
52 where por.po_release_id = p_por_id
53 and por.approved_date >= p_creation_date;
54
55 g_por_approved_date := app_date;
56 g_creation_date := p_creation_date;
57 g_por_id := p_por_id;
58
59 return app_date;
60 END get_approved_date_por;
61
62 FUNCTION get_approved_date_pll (p_creation_date IN DATE,
63 p_line_location_id IN NUMBER) return DATE IS
64 app_date DATE;
65
66 BEGIN
67
68 IF (p_creation_date = g_creation_date AND
69 p_line_location_id = g_line_location_id) THEN
70 return g_pll_approved_date;
71 END IF;
72
73 select min(approved_date)
74 into app_date
75 from po_line_locations_archive_all pll
76 where pll.line_location_id = p_line_location_id
77 and pll.approved_date >= p_creation_date;
78
79 g_pll_approved_date := app_date;
80 g_creation_date := p_creation_date;
81 g_line_location_id := p_line_location_id;
82
83 return app_date;
84 END get_approved_date_pll;
85
86
87 END POA_OLTP_GENERIC_PKG;
88