[Home] [Help]
PACKAGE BODY: APPS.BIV_DBI_COLLECTION_UTIL
Source
1 package body biv_dbi_collection_util as
2 /* $Header: bivsrvcutlb.pls 120.0 2005/05/24 18:25:19 appldev noship $ */
3
4 g_user_id number := fnd_global.user_id;
5 g_login_id number := fnd_global.login_id;
6
7 function correct_bad_audit
8 ( x_error_message out nocopy varchar2 )
9 return number as
10
11 begin
12
13 return 0;
14
15 exception
16 when others then
17 x_error_message := sqlerrm;
18 return -1;
19 end correct_bad_audit;
20
21 function get_schema_name
22 ( x_schema_name out nocopy varchar2
23 , x_error_message out nocopy varchar2 )
24 return number as
25
26 l_biv_schema varchar2(30);
27 l_status varchar2(30);
28 l_industry varchar2(30);
29
30 begin
31
32 if fnd_installation.get_app_info('BIV', l_status, l_industry, l_biv_schema) then
33 x_schema_name := l_biv_schema;
34 else
35 x_error_message := 'FIND_INSTALLATION.GET_APP_INFO returned false';
36 return -1;
37 end if;
38
39 return 0;
40
41 exception
42 when others then
43 x_error_message := 'Error in function get_schema_name : ' || sqlerrm;
44 return -1;
45
46 end get_schema_name;
47
48 function truncate_table
49 ( p_biv_schema in varchar2
50 , p_table_name in varchar2
51 , x_error_message out nocopy varchar2 )
52 return number as
53
54 begin
55
56 execute immediate 'truncate table ' || p_biv_schema || '.' || p_table_name;
57
58 return 0;
59
60 exception
61 when others then
62 x_error_message := 'Error in function truncate_table : ' || sqlerrm;
63 return -1;
64
65 end truncate_table;
66
67 function gather_statistics
68 ( p_biv_schema in varchar2
69 , p_table_name in varchar2
70 , x_error_message out nocopy varchar2)
71 return number as
72
73 begin
74
75 fnd_stats.gather_table_stats( ownname => p_biv_schema
76 , tabname => p_table_name
77 );
78
79 return 0;
80
81 exception
82 when others then
83 x_error_message := 'Error in function gather_statistics : ' || sqlerrm;
84 return -1;
85
86 end gather_statistics;
87
88 procedure set_log_error
89 ( p_rowid in rowid
90 , p_staging_error in varchar2 default null
91 , p_activity_error in varchar2 default null
92 , p_closed_error in varchar2 default null
93 , p_backlog_error in varchar2 default null
94 , p_resolution_error in varchar2 default null
95 ) as
96 begin
97 update biv_dbi_collection_log
98 set staging_error_message = decode(p_staging_error, null, staging_error_message
99 , p_staging_error)
100 , activity_error_message = decode(p_activity_error, null, activity_error_message
101 , p_activity_error)
102 , closed_error_message = decode(p_closed_error, null, closed_error_message
103 , p_closed_error)
104 , backlog_error_message = decode(p_backlog_error, null, backlog_error_message
105 , p_backlog_error)
106 , resolution_error_message = decode(p_resolution_error, null, resolution_error_message
107 , p_resolution_error)
108 , last_update_date = sysdate
109 , last_updated_by = g_user_id
110 , last_update_login = g_login_id
111 where rowid = p_rowid;
112
113 exception
114 when others then
115 bis_collection_utilities.log('Unable to update biv_dbi_collection_log with error:');
116 bis_collection_utilities.log(sqlerrm,1);
117
118 end set_log_error;
119
120 procedure get_last_log
121 ( x_rowid out nocopy rowid
122 , x_process_type out nocopy varchar2
123 , x_collect_from_date out nocopy date
124 , x_collect_to_date out nocopy date
125 , x_success_flag out nocopy varchar2
126 , x_staging_flag out nocopy varchar2
127 , x_activity_flag out nocopy varchar2
128 , x_closed_flag out nocopy varchar2
129 , x_backlog_flag out nocopy varchar2
130 , x_resolution_flag out nocopy varchar2
131 ) as
132
133 cursor c_log is
134 select
135 rowid
136 , process_type
137 , collect_from_date
138 , collect_to_date
139 , success_flag
140 , staging_table_flag
141 , activity_flag
142 , closed_flag
143 , backlog_flag
144 , resolution_flag
145 from
146 biv_dbi_collection_log
147 where
148 last_collection_flag = 'Y';
149
150 begin
151
152 open c_log;
153 fetch c_log into x_rowid
154 , x_process_type
155 , x_collect_from_date
156 , x_collect_to_date
157 , x_success_flag
158 , x_staging_flag
159 , x_activity_flag
160 , x_closed_flag
161 , x_backlog_flag
162 , x_resolution_flag;
163 close c_log;
164
165 end get_last_log;
166
167 function get_missing_owner_group_id
168 return number
169 is
170 begin
171 return -1;
172 end get_missing_owner_group_id;
173
174 function get_missing_inventory_item_id
175 return number
176 is
177 begin
178 return -1;
179 end get_missing_inventory_item_id;
180
181 function get_missing_organization_id
182 return number
183 is
184 begin
185 return -99;
186 end get_missing_organization_id;
187
188 end biv_dbi_collection_util;