DBA Data[Home] [Help]

PACKAGE BODY: APPS.CSI_GIS_INSTANCE_LOC_PUB_W

Source


1 package body csi_gis_instance_loc_pub_w as
2   /* $Header: csiwgilb.pls 120.0.12010000.2 2008/11/13 11:28:51 somitra noship $ */
3   rosetta_g_mistake_date date := to_date('01/01/+4713', 'MM/DD/SYYYY');
4   rosetta_g_miss_date date := to_date('01/01/-4712', 'MM/DD/SYYYY');
5   rosetta_g_mistake_date_high date := to_date('01/01/+4710', 'MM/DD/SYYYY');
6   rosetta_g_mistake_date_low date := to_date('01/01/-4710', 'MM/DD/SYYYY');
7 
8   -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
9   function rosetta_g_miss_date_in_map(d date) return date as
10   begin
11     if d > rosetta_g_mistake_date_high then return fnd_api.g_miss_date; end if;
12     if d < rosetta_g_mistake_date_low then return fnd_api.g_miss_date; end if;
13     return d;
14   end;
15 
16   function rosetta_g_miss_num_map(n number) return number as
17     a number := fnd_api.g_miss_num;
18     b number := 0-1962.0724;
19   begin
20     if n=a then return b; end if;
21     if n=b then return a; end if;
22     return n;
23   end;
24 
25   procedure rosetta_table_copy_in_p1(t out nocopy csi_gis_instance_loc_pub.csi_instance_geoloc_tbl_type, a0 JTF_NUMBER_TABLE
26     , a1 JTF_VARCHAR2_TABLE_100
27     , a2 JTF_VARCHAR2_TABLE_100
28     , a3 JTF_VARCHAR2_TABLE_100
29     , a4 JTF_VARCHAR2_TABLE_100
30     ) as
31     ddindx binary_integer; indx binary_integer;
32   begin
33   if a0 is not null and a0.count > 0 then
34       if a0.count > 0 then
35         indx := a0.first;
36         ddindx := 1;
37         while true loop
38           t(ddindx).instance_id := rosetta_g_miss_num_map(a0(indx));
39           t(ddindx).inst_latitude := a1(indx);
40           t(ddindx).inst_longitude := a2(indx);
41           t(ddindx).valid_flag := a3(indx);
42           t(ddindx).geocode_format := a4(indx);
43           ddindx := ddindx+1;
44           if a0.last =indx
45             then exit;
46           end if;
47           indx := a0.next(indx);
48         end loop;
49       end if;
50    end if;
51   end rosetta_table_copy_in_p1;
52   procedure rosetta_table_copy_out_p1(t csi_gis_instance_loc_pub.csi_instance_geoloc_tbl_type, a0 out nocopy JTF_NUMBER_TABLE
53     , a1 out nocopy JTF_VARCHAR2_TABLE_100
54     , a2 out nocopy JTF_VARCHAR2_TABLE_100
55     , a3 out nocopy JTF_VARCHAR2_TABLE_100
56     , a4 out nocopy JTF_VARCHAR2_TABLE_100
57     ) as
58     ddindx binary_integer; indx binary_integer;
59   begin
60   if t is null or t.count = 0 then
61     a0 := JTF_NUMBER_TABLE();
62     a1 := JTF_VARCHAR2_TABLE_100();
63     a2 := JTF_VARCHAR2_TABLE_100();
64     a3 := JTF_VARCHAR2_TABLE_100();
65     a4 := JTF_VARCHAR2_TABLE_100();
66   else
67       a0 := JTF_NUMBER_TABLE();
68       a1 := JTF_VARCHAR2_TABLE_100();
69       a2 := JTF_VARCHAR2_TABLE_100();
70       a3 := JTF_VARCHAR2_TABLE_100();
71       a4 := JTF_VARCHAR2_TABLE_100();
72       if t.count > 0 then
73         a0.extend(t.count);
74         a1.extend(t.count);
75         a2.extend(t.count);
76         a3.extend(t.count);
77         a4.extend(t.count);
78         ddindx := t.first;
79         indx := 1;
80         while true loop
81           a0(indx) := rosetta_g_miss_num_map(t(ddindx).instance_id);
82           a1(indx) := t(ddindx).inst_latitude;
83           a2(indx) := t(ddindx).inst_longitude;
84           a3(indx) := t(ddindx).valid_flag;
85           a4(indx) := t(ddindx).geocode_format;
86           indx := indx+1;
87           if t.last =ddindx
88             then exit;
89           end if;
90           ddindx := t.next(ddindx);
91         end loop;
92       end if;
93    end if;
94   end rosetta_table_copy_out_p1;
95 
96   procedure createupdate_inst_geoloc_info(p_api_version  NUMBER
97     , p_commit  VARCHAR2
98     , p2_a0 JTF_NUMBER_TABLE
99     , p2_a1 JTF_VARCHAR2_TABLE_100
100     , p2_a2 JTF_VARCHAR2_TABLE_100
101     , p2_a3 JTF_VARCHAR2_TABLE_100
102     , p2_a4 JTF_VARCHAR2_TABLE_100
103     , p_asset_context  VARCHAR2
104     , x_return_status out nocopy  VARCHAR2
105     , x_msg_count out nocopy  NUMBER
106     , x_msg_data out nocopy  VARCHAR2
107   )
108 
109   as
110     ddp_csi_instance_geoloc_tbl csi_gis_instance_loc_pub.csi_instance_geoloc_tbl_type;
111     ddindx binary_integer; indx binary_integer;
112   begin
113 
114     -- copy data to the local IN or IN-OUT args, if any
115 
116 
117     csi_gis_instance_loc_pub_w.rosetta_table_copy_in_p1(ddp_csi_instance_geoloc_tbl, p2_a0
118       , p2_a1
119       , p2_a2
120       , p2_a3
121       , p2_a4
122       );
123 
124 
125 
126 
127 
128     -- here's the delegated call to the old PL/SQL routine
129     csi_gis_instance_loc_pub.createupdate_inst_geoloc_info(p_api_version,
130       p_commit,
131       ddp_csi_instance_geoloc_tbl,
132       p_asset_context,
133       x_return_status,
134       x_msg_count,
135       x_msg_data);
136 
137     -- copy data back from the local variables to OUT or IN-OUT args, if any
138 
139 
140 
141 
142 
143 
144   end;
145 
146 end csi_gis_instance_loc_pub_w;