1 package WIP_JSI_Utils AUTHID CURRENT_USER as
2 /* $Header: wipjsius.pls 115.8 2002/11/29 10:29:21 rmahidha ship $ */
3
4 --
5 -- Constants
6 --
7
8 WIP_JSI_EXCEPTION constant number := -20239 ;
9
10 REQUEST_ABORTED exception ;
11 pragma exception_init(REQUEST_ABORTED, -20239) ;
12
13 --
14 -- Public Package Globals
15 --
16
17 -- What kind of processing is being done on the current record.
18 -- You should set this variable as appropriate.
19 current_process_phase number ;
20
21 -- Rowid of the locked row being processed.
22 -- You should not set this variable.
23 current_rowid rowid ;
24
25 -- How the current row is to be processed.
26 -- You should not set this variable.
27 validation_level number ;
28
29 -- Whether any error messages other than warnings have been encountered
30 -- for the current record.
31 -- You should not set this variable.
32 any_nonwarning_errors boolean ;
33
34 -- Interface_id of the locked row being processed.
35 -- You should not set this variable.
36 current_interface_id number;
37
38 --
39 -- Procedures and Functions
40 --
41
42
43 --
44 -- Prepares to process the request identified by p_interface_id.
45 -- Aborts if this request does not exist or is not currently set up
46 -- to be processed.
47 --
48 -- Think of this as the "constructor" of a request-processing session.
49 -- You must call this procedure before calling
50 -- 'end_processing_request' or 'abort_request'.
51 --
52 procedure
53 begin_processing_request (
54 p_interface_id in number,
55 p_validation_level in number
56 ) ;
57
58 --
59 -- Cleans up after processing a single request. If any errors have been
60 -- recorded, this procedure rolls back to the point when
61 -- 'begin_processing_request' was called. Stores any errors
62 -- in WIP_INTERFACE_ERRORS and updates WIP_JOB_SCHEDULE_INTERFACE to have
63 -- an error status if appropriate.
64 --
65 -- This is the "destructor" of a request-processing session.
66 -- You must call this procedure after all processing is complete.
67 --
68 procedure
69 end_processing_request ;
70
71 --
72 -- Throws the REQUEST_ABORTED exception.
73 --
74 procedure
75 abort_request ;
76
77 --
78 -- Saves the given error message for later insertion into
79 -- WIP_INTERFACE_ERRORS.
80 --
81 procedure
82 record_error_text (
83 p_text in varchar2,
84 p_warning_only in boolean default NULL
85 ) ;
86
87 --
88 -- Like 'record_error_text', but fetches the message text
89 -- from the AOL message dictionary using the supplied message name.
90 --
91 procedure
92 record_error (
93 p_message_name in varchar2,
94 p_warning_only in boolean default NULL
95 ) ;
96
97 --
98 -- Like 'record_error', but retrieves the current error message
99 -- from the AOL message stack.
100 --
101 procedure
102 record_current_error (
103 p_warning_only in boolean default NULL
104 ) ;
105
106 --
107 -- Like 'record_error_text', but issues a nonwarning message using a
108 -- pre-set text indicating that the value in the argument
109 -- column is invalid.
110 --
111 procedure
112 record_invalid_column_error (
113 p_column_name in varchar2
114 ) ;
115
116 --
117 -- Like 'record_error_text', but issues a warning message using a
118 -- pre-set text indicating that the value in the argument
119 -- column is being ignored.
120 --
121 procedure
122 record_ignored_column_warning (
123 p_column_name in varchar2
124 ) ;
125
126 --
127 -- Returns a string containing the current SQLCODE which
128 -- can be used to precede an internal error message.
129 --
130 function
131 sql_error_prefix return varchar2 ;
132
133 --
134 -- Determines whether the current row being examined matches the
135 -- additional where-clause provided.
136 --
137 function
138 request_matches_condition (p_where_clause in varchar2) return boolean ;
139
140 --
141 -- Records an error with the given message name if the given condition
142 -- is true about the current row.
143 --
144 procedure
145 nonfatal_error_if(p_condition in varchar2, p_message in varchar2) ;
146
147 --
148 -- Records an error with the given message name, and then aborts
149 -- processing of the current row, if the condition matches the current row.
150 --
151 procedure
152 fatal_error_if(p_condition in varchar2, p_message in varchar2) ;
153
154 --
155 -- If the specified column in the current request null,
156 -- and the specified condition is also true of the current request,
157 -- this procedure sets the column to the given expression.
158 --
159 procedure
160 default_if_null (
161 p_column in varchar2,
162 p_condition in varchar2,
163 p_default_value_expression in varchar2
164 ) ;
165
166 --
167 -- If the specified column is null, and the load type is in the list
168 -- specified, this issues a warning message that the column is being
169 -- ignored.
170 --
171 procedure
172 warn_irrelevant_column (
173 p_column in varchar2,
174 p_load_type_list in varchar2 default null
175 ) ;
176
177 --
178 -- If the load type is not in the exception list, this procedure
179 -- checks the specified columns and issues a warning message if
180 -- both of them contain a value.
181 --
182 procedure
183 warn_redundant_column (
184 p_column_being_used in varchar2,
185 p_column_being_ignored in varchar2,
186 p_exception_load_type_list in varchar2
187 ) ;
188
189 --
190 -- If the load type is not in the exception list, and if necessary,
191 -- this procedure attempts to derive a value the ID column from the value,
192 -- if any, that is in the code column. If unsuccessful, it aborts
193 -- processing of the current row.
194 --
195 procedure
196 derive_id_from_code (
197 p_id_column in varchar2,
198 p_code_column in varchar2,
199 p_derived_value_expression in varchar2,
200 p_exception_load_type_list in varchar2,
201 p_required in boolean default NULL
202 ) ;
203
204
205
206 --
207 -- Private
208 --
209
210
211 cursor matching_request (p_interface_id in number) is
212 select rowid
213 from wip_job_schedule_interface
214 where
215 interface_id = p_interface_id and
216 process_phase = WIP_CONSTANTS.ML_VALIDATION and
217 process_status = WIP_CONSTANTS.RUNNING
218 for update ;
219
220 /* type request_error is record (
221 error_type wip_interface_errors.error_type %type,
222 error wip_interface_errors.error %type
223 ) ;
224
225 type error_list is table of request_error index by binary_integer ;
226
227 current_errors error_list ; */
228
229 any_current_request boolean ;
230
231 end WIP_JSI_Utils ;