[Home] [Help]
PACKAGE BODY: APPS.AMS_LISTIMPORT_PVT
Source
1 PACKAGE BODY AMS_ListImport_PVT AS
2 /* $Header: amsvimlb.pls 120.10.12010000.3 2008/12/23 10:50:18 rsatyava ship $ */
3
4 -----------------------------------------------------------
5
6 -- PACKAGE
7 -- AMS_ListImport_PVT
8 --
9 -- PURPOSE
10 -- This purpose of this program is to create organization,person
11 -- ,party relationship, org contacts, locations , party sites,
12 -- email and phone records for B2B or B2C type customer's
13 --
14 -- Call TCA API's to create the records in HZ schema.
15 --
16 --
17 -- For B2B creates the following using TCA API's
18 --
19 -- 1. Create organization
20 -- 2. Create Person
21 -- 3. Create Party Relation
22 -- 4. Create Party for Party Relationship
23 -- 5. Create Org contact
24 -- 6. Create Location (if address is available)
25 -- 7. Create Party Site (if address is available)
26 -- 8. Create Contact Points (if contact points are available)
27 --
28 --
29 -- For B2C creates the following using TCA API's
30 --
31 -- 1. Create Person
32 -- 2. Create Location (if address is available)
33 -- 3. Create Party Site (if address is available)
34 -- 4. Create Contact Points (if contact points are available)
35 --
36 -- PROCEDURES
37 -- list_import_to_hz
38 --
39 -- PARAMETERS
40 -- INPUT
41 -- p_import_list_header_id NUMBER.
42 --
43 -- OUTPUT
44 -- Errbuf VARCHAR2 -- Conc Pgm Error mesgs.
45 -- RetCode VARCHAR2 -- Conc Pgm Error Code.
46 -- 0 - Success, 2 - Failure.
47 --
48 -- HISTORY amsvimlb.pls
49 -- 19-Mar-2001 usingh Created.
50 -- ---------------------------------------------------------
51 G_ARC_IMPORT_HEADER CONSTANT VARCHAR2(30) := 'IMPH';
52 g_pkg_name CONSTANT VARCHAR2(30):='AMS_LISTIMPORT_PVT';
53 g_prof VARCHAR2(50) := fnd_profile.value('HZ_EXECUTE_API_CALLOUTS');
54 --
55 -- This program processes the xml data.
56 --
57 AMS_DEBUG_HIGH_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH);
58 AMS_DEBUG_LOW_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW);
59 AMS_DEBUG_MEDIUM_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_MEDIUM);
60
61 -- SOLIN, Bug 3792806
62 -- Using binded variables to replace literals.
63 G_STATUS_SUCCESS CONSTANT VARCHAR2(30) := 'SUCCESS';
64 G_STATUS_DUPLICATE CONSTANT VARCHAR2(30) := 'DUPLICATE';
65 G_STATUS_ERROR CONSTANT VARCHAR2(30) := 'ERROR';
66 G_STATUS_RELOAD CONSTANT VARCHAR2(30) := 'RELOAD';
67 -- SOLIN, end
68
69 PROCEDURE Process_b2b_xml_data (
70 p_import_list_header_id IN NUMBER,
71 p_xml_element_id IN NUMBER,
72 p_cust_tbl IN OUT NOCOPY cust_data_in_tbl,
73 x_return_status OUT NOCOPY VARCHAR2,
74 x_msg_data OUT NOCOPY VARCHAR2
75 );
76
77 --
78 -- This program processes the xml data.
79 --
80 PROCEDURE Process_b2c_xml_data (
81 p_import_list_header_id IN NUMBER,
82 p_xml_element_id IN NUMBER,
83 p_cust_tbl IN OUT NOCOPY cust_b2c_data_in_tbl,
84 x_return_status OUT NOCOPY VARCHAR2,
85 x_msg_data OUT NOCOPY VARCHAR2
86 );
87
88 --
89 -- This program populates the ams_imp-source_lines table.
90 --
91 Procedure Create_b2b_src_lines(
92 p_import_list_header_id IN number,
93 p_cust_b2b_tbl in cust_data_in_tbl,
94 x_return_status OUT NOCOPY varchar2,
95 x_msg_data OUT NOCOPY varchar2) ;
96
97 --
98 -- This program populates the ams_imp-source_lines table.
99 --
100 Procedure Create_b2c_src_lines(
101 p_import_list_header_id IN number,
102 p_cust_b2c_tbl in cust_b2c_data_in_tbl,
103 x_return_status OUT NOCOPY varchar2,
104 x_msg_data OUT NOCOPY varchar2) ;
105
106 --
107 -- This procedure validates the date column.
108 --
109
110 procedure date_validate (
111 p_import_list_header_id IN NUMBER,
112 p_import_source_line_id IN NUMBER,
113 p_batch_id IN NUMBER,
114 p_column1 IN VARCHAR2,
115 p_column2 IN VARCHAR2,
116 p_column3 IN VARCHAR2,
117 p_column4 IN VARCHAR2,
118 p_column5 IN VARCHAR2,
119 p_column6 IN VARCHAR2
120 );
121 --
122 -- This procedure generates the status of import
123 --
124 --
125 PROCEDURE process_status_code (
126 p_import_list_header_id IN NUMBER
127 );
128
129 --
130 -- This procedure is used to capture lead errors.
131 --
132 --
133 PROCEDURE capture_lead_error(
134 p_import_list_header_id IN NUMBER
135 );
136
137 --
138 -- for XML updates the error in the element table
139 --
140 PROCEDURE update_xml_error_text (
141 p_import_list_header_id IN NUMBER,
142 p_import_type IN varchar2);
143
144
145 --
146 -- This procedure creates list notes from import
147 --
148 --
149 PROCEDURE create_list_note
150 ( p_import_list_header_id in number,
151 p_import_source_line_id in number,
152 p_party_id in number,
153 p_source_object_code in varchar2,
154 p_note_text in varchar2,
155 x_return_status OUT NOCOPY VARCHAR2,
156 x_msg_count OUT NOCOPY NUMBER,
157 x_msg_data OUT NOCOPY VARCHAR2
158 );
159
160
161 --
162 -- This procedure is used to update the status for b2b/b2c import.
163 --
164 --
165 PROCEDURE update_cust_import_status(
166 p_import_list_header_id IN NUMBER
167 );
168
169 --
170 -- This procedure is updates the records with request_id ordered by party_name
171 --
172 --
173 PROCEDURE org_party_update(
174 p_import_list_header_id IN NUMBER,
175 p_request_id IN NUMBER,
176 p_batch_size IN NUMBER,
177 x_return_status OUT NOCOPY VARCHAR2,
178 x_msg_count OUT NOCOPY NUMBER,
179 x_msg_data OUT NOCOPY VARCHAR2
180 );
181
182 --
183 -- This procedure is used for existence checking for organization
184 --
185 --
186 PROCEDURE org_existence_checking(
187 p_import_list_header_id IN NUMBER,
188 x_return_status OUT NOCOPY VARCHAR2,
189 x_msg_count OUT NOCOPY NUMBER,
190 x_msg_data OUT NOCOPY VARCHAR2
191 );
192
193 --
194 -- This procedure is used for existence checking for organization with orig system reference
195 --
196 --
197 PROCEDURE org_existence_checking_osr(
198 p_import_list_header_id IN NUMBER,
199 x_return_status OUT NOCOPY VARCHAR2,
200 x_msg_count OUT NOCOPY NUMBER,
201 x_msg_data OUT NOCOPY VARCHAR2
202 );
203
204 --
205 -- This procedure is used for existence checking for Person
206 --
207 --
208 PROCEDURE per_existence_checking(
209 p_import_list_header_id IN NUMBER,
210 x_return_status OUT NOCOPY VARCHAR2,
211 x_msg_count OUT NOCOPY NUMBER,
212 x_msg_data OUT NOCOPY VARCHAR2
213 );
214 --
215 -- This procedure is used for existence checking for Person with osr
216 --
217 --
218 PROCEDURE per_existence_checking_osr(
219 p_import_list_header_id IN NUMBER,
220 x_return_status OUT NOCOPY VARCHAR2,
221 x_msg_count OUT NOCOPY NUMBER,
222 x_msg_data OUT NOCOPY VARCHAR2
223 );
224 --
225 -- This procedure is used for existence checking for organization contacts
226 --
227 --
228 PROCEDURE org_cont_existence_checking(
229 p_import_list_header_id IN NUMBER,
230 x_return_status OUT NOCOPY VARCHAR2,
231 x_msg_count OUT NOCOPY NUMBER,
232 x_msg_data OUT NOCOPY VARCHAR2
233 );
234
235 --
236 -- This procedure is used for existence checking for organization contacts with osr
237 --
238 --
239 PROCEDURE org_cont_existence_chk_osr(
240 p_import_list_header_id IN NUMBER,
241 x_return_status OUT NOCOPY VARCHAR2,
242 x_msg_count OUT NOCOPY NUMBER,
243 x_msg_data OUT NOCOPY VARCHAR2
244 );
245
246 --
247 -- This procedure is used for existence checking for organization address
248 --
249 --
250 PROCEDURE org_address_existence_checking(
251 p_import_list_header_id IN NUMBER,
252 x_return_status OUT NOCOPY VARCHAR2,
253 x_msg_count OUT NOCOPY NUMBER,
254 x_msg_data OUT NOCOPY VARCHAR2
255 );
256
257 --
258 -- This procedure is used for existence checking for organization address
259 --
260 --
261 PROCEDURE org_address1_exist_checking(
262 p_import_list_header_id IN NUMBER,
263 x_return_status OUT NOCOPY VARCHAR2,
264 x_msg_count OUT NOCOPY NUMBER,
265 x_msg_data OUT NOCOPY VARCHAR2
266 );
267
268 --
269 -- This procedure is used for existence checking for person address
270 --
271 --
272 PROCEDURE per_address_existence_checking(
273 p_import_list_header_id IN NUMBER,
274 x_return_status OUT NOCOPY VARCHAR2,
275 x_msg_count OUT NOCOPY NUMBER,
276 x_msg_data OUT NOCOPY VARCHAR2
277 );
278
279
280 --
281 -- This procedure is updates the records with transposed phone number.
282 --
283 --
284 PROCEDURE gen_transposed_phone_number(
285 p_import_list_header_id IN NUMBER,
286 x_return_status OUT NOCOPY VARCHAR2,
287 x_msg_count OUT NOCOPY NUMBER,
288 x_msg_data OUT NOCOPY VARCHAR2
289 );
290
291 -- *********************************************************
292 --
293 -- This function returns the value for the element.
294 --
295 FUNCTION Get_Element_VALUE (p_column_name IN VARCHAR2,
296 p_search_tbl IN AMS_IMPORT_XML_PVT.xml_element_set_type)
297 RETURN VARCHAR2
298 IS
299 x_element_id NUMBER;
300 x_value VARCHAR2(2000) := null;
301 BEGIN
302 for i in 1..p_search_tbl.COUNT loop
303
304 if (p_search_tbl(i).column_name = p_column_name) then
305 x_value := p_search_tbl(i).data;
306 exit;
307 end if;
308 end loop;
309 RETURN (x_value);
310 END Get_Element_VALUE;
311
312
313 --
314 -- This function returns the id for the element.
315 --
316 FUNCTION Get_Element_ID (p_column_name IN VARCHAR2,
317 p_search_tbl IN AMS_IMPORT_XML_PVT.xml_element_set_type)
318 RETURN NUMBER
319 IS
320 x_element_id NUMBER;
321 x_value VARCHAR2(2000);
322 BEGIN
323 for i in 1..p_search_tbl.COUNT loop
324
325 if (p_search_tbl(i).column_name = p_column_name) then
326 x_element_id := p_search_tbl(i).imp_xml_element_id;
327 exit;
328 end if;
329 end loop;
330 RETURN (x_element_id);
331 END Get_Element_ID;
332
333
334 --
335 -- ---------------------------------------------------------
336 -- This concurrent program populates the data to TCA tables
337 -- from OMO table.
338 --
339
340 PROCEDURE list_import_to_hz (
341 Errbuf OUT NOCOPY VARCHAR2,
342 Retcode OUT NOCOPY VARCHAR2,
343 p_import_list_header_id NUMBER,
344 p_number_of_processes NUMBER DEFAULT 1
345 ) IS
346 x_return_status varchar(1);
347 l_ret_status varchar(1);
348 x_msg_count number;
349 x_msg_data varchar(4000);
350 x_b2b varchar(30);
351 x_tmp_var VARCHAR2(4000);
352 x_tmp_var1 VARCHAR2(4000);
353 l_return_status VARCHAR2(1);
354 i_import_source_line_id number;
355 i_number_of_rows_processed number := 0;
356 i_party_id number;
357
358 L_COUNT NUMBER := 0;
359 l_overlay VARCHAR2(1);
360 l_b2b_party_id number;
361 l_b2c_party_id number;
362 l_enabled_flag VARCHAR2(1);
363 x_new_party VARCHAR2(1);
364 x_component_name VARCHAR2(60);
365 x_notes varchar(2000);
366 x_source_object_code varchar2(60);
367 l_sa_email VARCHAR2(2000);
368 l_vr_code VARCHAR2(30);
369 l_vr_code_exists VARCHAR2(1);
370 l_resource_id number;
371 -- sranka 1/14/2003
372 -- added l_import_source_line_id
373 l_import_source_line_id number;
374
375 l_header_status VARCHAR2(30);
376 l_request_id number;
377 l_total_recs number;
378 l_batch_size number;
379 l_numb_of_inst number;
380 l_lookup_code varchar2(60);
381 l_user_status_id number;
382 l_mod number;
383 new_request_id number;
384 l_parent_request_id number;
385
386 -- For the Parent Wait for child to finish
387 l_req_data VARCHAR2(10);
388 l_req_data_counter NUMBER;
389 i_batch_size number;
390
391
392 cursor c_header_status is
393 select nvl(batch_size,0),parent_request_id from ams_imp_list_headers_all
394 where import_list_header_id = p_import_list_header_id;
395
396 cursor c_total_recs is
397 select count(*) from ams_imp_source_lines
398 where import_list_header_id = p_import_list_header_id
399 and load_status in ('ACTIVE','RELOAD');
400
401
402
403 -- Cursor to check if it's B2B or B2C party type.
404
405 cursor b2borb2c is
406 select import_type from ams_imp_list_headers_all
407 where import_list_header_id = p_import_list_header_id;
408
409
410 /* For Mapped party */
411 cursor party_mapped is
412 SELECT 'Y' FROM ams_list_src_fields sf,
413 ams_imp_list_headers_all hd
414 WHERE sf.field_column_name = 'PARTY_ID'
415 AND sf.enabled_flag = 'Y'
416 AND sf.list_source_type_id = hd.list_source_type_id
417 and hd.import_type = 'CUSTOMER'
418 AND hd.import_list_header_id = p_import_list_header_id;
419
420 -- Cursor for B2B party type
421
422 cursor b2b is
423 SELECT
424 IMPORT_SOURCE_LINE_ID,
425 PARTY_NAME,
426 FISCAL_YEAREND_MONTH,
427 DUNS_NUMBER,
428 EMPLOYEES_TOTAL,
429 LINE_OF_BUSINESS,
430 YEAR_ESTABLISHED,
431 TAX_REFERENCE,
432 CEO_NAME,
433 PERSON_FIRST_NAME,
434 PERSON_MIDDLE_NAME,
435 PERSON_LAST_NAME,
436 PERSON_NAME_SUFFIX,
437 PERSON_name_prefix,
438 -- to_date(BEST_TIME_CONTACT_BEGIN,'MM/DD/YYYY'),
439 -- to_date(BEST_TIME_CONTACT_END,'MM/DD/YYYY'),
440 COUNTRY,
441 ADDRESS1,
442 ADDRESS2,
443 CITY,
444 COUNTY,
445 STATE,
446 PROVINCE,
447 POSTAL_CODE,
448 --TIME_ZONE,
449 EMAIL_ADDRESS,
450 PHONE_COUNTRY_CODE,
451 PHONE_AREA_CODE,
452 PHONE_NUMBER,
453 PHONE_EXTENTION,
454 DEPARTMENT,
455 JOB_TITLE,
456 JOB_TITLE_CODE, -- 5033551
457 DECISION_MAKER_FLAG,
458 SIC_CODE,
459 SIC_CODE_TYPE,
460 -- TOTAL_NUM_OF_ORDERS,
461 -- TOTAL_ORDERED_AMOUNT,
462 -- to_date(LAST_ORDERED_DATE,'MM/DD/YYYY'),
463 ANALYSIS_FY ,
464 CURR_FY_POTENTIAL_REVENUE,
465 NEXT_FY_POTENTIAL_REVENUE,
466 GSA_INDICATOR_FLAG ,
467 MISSION_STATEMENT ,
468 ORGANIZATION_NAME_PHONETIC,
469 CATEGORY_CODE ,
470 JGZZ_FISCAL_CODE ,
471 -- TAX_NAME ,
472 ADDRESS3 ,
473 ADDRESS4 ,
474 ADDRESS_LINES_PHONETIC ,
475 -- APARTMENT_FLAG ,
476 -- bug 4641591: columns obsolete
477 -- PO_BOX_NUMBER ,
478 -- HOUSE_NUMBER ,
479 -- STREET_SUFFIX ,
480 -- SECONDARY_SUFFIX_ELENENT ,
481 -- STREET ,
482 -- RURAL_ROUTE_TYPE ,
483 -- RURAL_ROUTE_NUMBER ,
484 -- STREET_NUMBER ,
485 -- FLOOR ,
486 -- SUITE ,
487 POSTAL_PLUS4_CODE ,
488 -- OVERSEAS_ADDRESS_FLAG ,
489 identifying_address_flag ,
490 party_id ,
491 -- to_date(ADDRESS_EFFECTIVE_DATE,'MM/DD/YYYY'),
492 -- to_date(ADDRESS_EXPIRATION_DATE,'MM/DD/YYYY'),
493 ADDRESS_EFFECTIVE_DATE,
494 ADDRESS_EXPIRATION_DATE,
495 --ANNUAL_REVENUE,
496 --ANNUAL_REVENUE_CURRENCY,
497 BRANCH_FLAG,
498 NVL(BUSINESS_LINE,LINE_OF_BUSINESS),
499 BUSINESS_SCOPE,
500 CHIEF_EXECUTIVE_TITLE,
501 CONGRESSIONAL_DISTRICT_CODE,
502 CONTROL_YEAR,
503 CORPORATION_CLASS,
504 CREDIT_SCORE,
505 CREDIT_SCORE_COMMENTARY,
506 --CUSTOMER_CATEGORY,
507 DB_RATING,
508 DATE_OF_BIRTH,
509 DATE_OF_DEATH,
510 -- to_date(DATE_OF_BIRTH,'MM/DD/YYYY'),
511 -- to_date(DATE_OF_DEATH,'MM/DD/YYYY'),
512 DEBARMENTS_COUNT,
513 DEBARTMENTS_DATE,
514 -- to_date(DEBARTMENTS_DATE,'MM/DD/YYYY'),
515 DECLARED_ETHNICITY,
516 DEPARTMENT_INDICATOR,
517 DESCRIPTION,
518 DISADVANTAGED_INDICATOR,
519 ENQUIRY_DUNS,
520 EXPORT_INDICATOR,
521 FAILURE_SCORE,
522 FAILURE_SCORE_COMMENTARY,
523 FAILURE_SCORE_NATL_PERCENTILE,
524 FAILURE_SCORE_OVERRIDE_CODE,
525 --FISCAL_CODE,
526 GLOBAL_FAILURE_SCORE,
527 HEADQUARTER_BRANCH_INDICATOR,
528 HEAD_OF_HOUSEHOLD_FLAG,
529 HOUSEHOLD_SIZE,
530 IMPORT_INDICATOR,
531 ORGANIZATION_KNOWN_AS,
532 ORGANIZATION_KNOWN_AS2,
533 ORGANIZATION_KNOWN_AS3,
534 ORGANIZATION_KNOWN_AS4,
535 ORGANIZATION_KNOWN_AS5,
536 PERSON_KNOWN_AS,
537 PERSON_KNOWN_AS2,
538 PERSON_KNOWN_AS3,
539 PERSON_KNOWN_AS4,
540 PERSON_KNOWN_AS5,
541 LABOR_SURPLUS_INDICATOR,
542 LOCAL_ACTIVITY_CODE,
543 LOCAL_ACTIVITY_CODE_TYPE,
544 LOCATION_DIRECTIONS ,
545 --LOCATION_STATUS,
546 MARITAL_STATUS,
547 -- to_date(MARITAL_STATUS_EFFECTIVE_DATE,'MM/DD/YYYY'),
548 MARITAL_STATUS_EFFECTIVE_DATE,
549 MINORITY_OWNED_INDICATOR,
550 MINORITY_OWNED_TYPE,
551 --ORGANIZATION_ALIAS,
552 ORGANIZATION_TYPE,
553 ORGANIZATION_URL,
554 OUT_OF_BUSINESS_INDICATOR,
555 PERSONAL_INCOME,
556 PERSON_ACADEMIC_TITLE,
557 PERSON_FIRST_NAME_PHONETIC,
558 PERSON_LAST_NAME_PHONETIC,
559 MIDDLE_NAME_PHONETIC,
560 PERSON_NAME_PHONETIC,
561 PERSON_PREVIOUS_TITLE_NAME,
562 PLACE_OF_BIRTH,
563 --PREFERRED_NAME,
564 PRINCIPAL_NAME,
565 PRINCIPAL_TITLE,
566 PUBLIC_PRIVATE_OWNERSHIP_FLAG,
567 RENT_OWNED_INDICATOR,
568 --RENT_OWNER_INDICATOR,
569 SECOND_TITLE,
570 SHORT_DESCRIPTION,
571 SMALL_BUSINESS_INDICATOR,
572 -- TAX_ID,
573 WOMAN_OWNED_INDICATOR,
574 ORGANIZATION_ATTRIBUTE1,
575 ORGANIZATION_ATTRIBUTE2,
576 ORGANIZATION_ATTRIBUTE3,
577 ORGANIZATION_ATTRIBUTE4,
578 ORGANIZATION_ATTRIBUTE5,
579 ORGANIZATION_ATTRIBUTE6,
580 ORGANIZATION_ATTRIBUTE7,
581 ORGANIZATION_ATTRIBUTE8,
582 ORGANIZATION_ATTRIBUTE9,
583 ORGANIZATION_ATTRIBUTE10,
584 ORGANIZATION_ATTRIBUTE11,
585 ORGANIZATION_ATTRIBUTE12,
586 ORGANIZATION_ATTRIBUTE13,
587 ORGANIZATION_ATTRIBUTE14,
588 ORGANIZATION_ATTRIBUTE15,
589 PERSON_ATTRIBUTE1,
590 PERSON_ATTRIBUTE2,
591 PERSON_ATTRIBUTE3,
592 PERSON_ATTRIBUTE4,
593 PERSON_ATTRIBUTE5,
594 PERSON_ATTRIBUTE6,
595 PERSON_ATTRIBUTE7,
596 PERSON_ATTRIBUTE8,
597 PERSON_ATTRIBUTE9,
598 PERSON_ATTRIBUTE10,
599 PERSON_ATTRIBUTE11,
600 PERSON_ATTRIBUTE12,
601 PERSON_ATTRIBUTE13,
602 PERSON_ATTRIBUTE14,
603 PERSON_ATTRIBUTE15,
604 ORG_CONTACT_ATTRIBUTE1,
605 ORG_CONTACT_ATTRIBUTE2,
606 ORG_CONTACT_ATTRIBUTE3,
607 ORG_CONTACT_ATTRIBUTE4,
608 ORG_CONTACT_ATTRIBUTE5,
609 ORG_CONTACT_ATTRIBUTE6,
610 ORG_CONTACT_ATTRIBUTE7,
611 ORG_CONTACT_ATTRIBUTE8,
612 ORG_CONTACT_ATTRIBUTE9,
613 ORG_CONTACT_ATTRIBUTE10,
614 ORG_CONTACT_ATTRIBUTE11,
615 ORG_CONTACT_ATTRIBUTE12,
616 ORG_CONTACT_ATTRIBUTE13,
617 ORG_CONTACT_ATTRIBUTE14,
618 ORG_CONTACT_ATTRIBUTE15,
619 ADDRESS_ATTRIBUTE1,
620 ADDRESS_ATTRIBUTE2,
621 ADDRESS_ATTRIBUTE3,
622 ADDRESS_ATTRIBUTE4,
623 ADDRESS_ATTRIBUTE5,
624 ADDRESS_ATTRIBUTE6,
625 ADDRESS_ATTRIBUTE7,
626 ADDRESS_ATTRIBUTE8,
627 ADDRESS_ATTRIBUTE9,
628 ADDRESS_ATTRIBUTE10,
629 ADDRESS_ATTRIBUTE11,
630 ADDRESS_ATTRIBUTE12,
631 ADDRESS_ATTRIBUTE13,
632 ADDRESS_ATTRIBUTE14,
633 ADDRESS_ATTRIBUTE15,
634 FAX_COUNTRY_CODE,
635 FAX_AREA_CODE,
636 FAX_NUMBER,
637 ORG_ATTRIBUTE_CATEGORY,
638 PERSON_ATTRIBUTE_CATEGORY,
639 ORG_CONTACT_ATTRIBUTE_CATEGORY,
640 ADDRESS_ATTRIBUTE_CATEGORY ,
641 PARTY_SITE_USE,
642 notes,
643 VEHICLE_RESPONSE_CODE ,
644 SALES_AGENT_EMAIL_ADDRESS ,
645 ORIG_SYSTEM_REFERENCE,
646
647 -- sranka 3/21/2003
648 -- made changes for supporting EMPLOYEE_OF" relationship
649 RELATIONSHIP_TYPE,
650 RELATIONSHIP_CODE,
651 org_email_address,
652 ORG_PH_COUNTRY_CODE,
653 ORG_PH_AREA_CODE,
654 ORG_PH_NUMBER,
655 ORG_PH_EXTENSION,
656 ORG_PHONE_TYPE,
657 PHONE_TYPE,
658
659
660 -- sranka Made the changes for COLT Enhancement 7/15/2003
661 ORG_COUNTRY,
662 ORG_ADDRESS1,
663 ORG_ADDRESS2,
664 ORG_ADDRESS3,
665 ORG_ADDRESS4,
666 ORG_CITY,
667 ORG_COUNTY,
668 ORG_STATE,
669 ORG_PROVINCE,
670 ORG_POSTAL_CODE,
671 ORG_ADDR_ATTRIBUTE_CATEGORY,
672 ORG_ADDR_ATTRIBUTE1,
673 ORG_ADDR_ATTRIBUTE2,
674 ORG_ADDR_ATTRIBUTE3,
675 ORG_ADDR_ATTRIBUTE4,
676 ORG_ADDR_ATTRIBUTE5,
677 ORG_ADDR_ATTRIBUTE6,
678 ORG_ADDR_ATTRIBUTE7,
679 ORG_ADDR_ATTRIBUTE8,
680 ORG_ADDR_ATTRIBUTE9,
681 ORG_ADDR_ATTRIBUTE10,
682 ORG_ADDR_ATTRIBUTE11,
683 ORG_ADDR_ATTRIBUTE12,
684 ORG_ADDR_ATTRIBUTE13,
685 ORG_ADDR_ATTRIBUTE14,
686 ORG_ADDR_ATTRIBUTE15,
687 ORG_ADDR_ATTRIBUTE16,
688 ORG_ADDR_ATTRIBUTE17,
689 ORG_ADDR_ATTRIBUTE18,
690 ORG_ADDR_ATTRIBUTE19,
691 ORG_ADDR_ATTRIBUTE20,
692 ORG_PS_ATTRIBUTE_CATEGORY,
693 ORG_PS_ATTRIBUTE1,
694 ORG_PS_ATTRIBUTE2,
695 ORG_PS_ATTRIBUTE3,
696 ORG_PS_ATTRIBUTE4,
697 ORG_PS_ATTRIBUTE5,
698 ORG_PS_ATTRIBUTE6,
699 ORG_PS_ATTRIBUTE7,
700 ORG_PS_ATTRIBUTE8,
701 ORG_PS_ATTRIBUTE9,
702 ORG_PS_ATTRIBUTE10,
703 ORG_PS_ATTRIBUTE11,
704 ORG_PS_ATTRIBUTE12,
705 ORG_PS_ATTRIBUTE13,
706 ORG_PS_ATTRIBUTE14,
707 ORG_PS_ATTRIBUTE15,
708 ORG_PS_ATTRIBUTE16,
709 ORG_PS_ATTRIBUTE17,
710 ORG_PS_ATTRIBUTE18,
711 ORG_PS_ATTRIBUTE19,
712 ORG_PS_ATTRIBUTE20,
713 ORG_CPS_ATTRIBUTE_CATEGORY,
714 ORG_CPS_ATTRIBUTE1,
715 ORG_CPS_ATTRIBUTE2,
716 ORG_CPS_ATTRIBUTE3,
717 ORG_CPS_ATTRIBUTE4,
718 ORG_CPS_ATTRIBUTE5,
719 ORG_CPS_ATTRIBUTE6,
720 ORG_CPS_ATTRIBUTE7,
721 ORG_CPS_ATTRIBUTE8,
722 ORG_CPS_ATTRIBUTE9,
723 ORG_CPS_ATTRIBUTE10,
724 ORG_CPS_ATTRIBUTE11,
725 ORG_CPS_ATTRIBUTE12,
726 ORG_CPS_ATTRIBUTE13,
727 ORG_CPS_ATTRIBUTE14,
728 ORG_CPS_ATTRIBUTE15,
729 ORG_CPS_ATTRIBUTE16,
730 ORG_CPS_ATTRIBUTE17,
731 ORG_CPS_ATTRIBUTE18,
732 ORG_CPS_ATTRIBUTE19,
733 ORG_CPS_ATTRIBUTE20,
734 NATIVE_LANGUAGE,
735 ORGANIZATION_ATTRIBUTE16,
736 ORGANIZATION_ATTRIBUTE17,
737 ORGANIZATION_ATTRIBUTE18,
738 ORGANIZATION_ATTRIBUTE19,
739 ORGANIZATION_ATTRIBUTE20,
740 ORGANIZATION_ATTRIBUTE21,
741 ORGANIZATION_ATTRIBUTE22,
742 ORGANIZATION_ATTRIBUTE23,
743 ORGANIZATION_ATTRIBUTE24,
744 PERSON_ATTRIBUTE16,
745 PERSON_ATTRIBUTE17,
746 PERSON_ATTRIBUTE18,
747 PERSON_ATTRIBUTE19,
748 PERSON_ATTRIBUTE20,
749 --PERSON_ATTRIBUTE21,
750 --PERSON_ATTRIBUTE22,
751 --PERSON_ATTRIBUTE23,
752 --PERSON_ATTRIBUTE24,
753 ORG_CONTACT_ATTRIBUTE16,
754 ORG_CONTACT_ATTRIBUTE17,
755 ORG_CONTACT_ATTRIBUTE18,
756 ORG_CONTACT_ATTRIBUTE19,
757 ORG_CONTACT_ATTRIBUTE20,
758 ORG_CONTACT_ATTRIBUTE21,
759 ORG_CONTACT_ATTRIBUTE22,
760 ORG_CONTACT_ATTRIBUTE23,
761 ORG_CONTACT_ATTRIBUTE24,
762 ADDRESS_ATTRIBUTE16,
763 ADDRESS_ATTRIBUTE17,
764 ADDRESS_ATTRIBUTE18,
765 ADDRESS_ATTRIBUTE19,
766 ADDRESS_ATTRIBUTE20
767 FROM AMS_HZ_B2B_MAPPING_V
768 WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
769 and request_id = l_request_id
770 AND load_status in ('ACTIVE','RELOAD');
771
772 -- Cursor B2C Party Type
773
774 CURSOR B2C IS
775 SELECT
776 IMPORT_SOURCE_LINE_ID,
777 PERSON_FIRST_NAME,
778 PERSON_MIDDLE_NAME,
779 PERSON_LAST_NAME,
780 PERSON_NAME_SUFFIX,
781 PERSON_name_prefix,
782 -- to_date(BEST_TIME_CONTACT_BEGIN,'MM/DD/YYYY'),
783 -- to_date(BEST_TIME_CONTACT_END,'MM/DD/YYYY'),
784 COUNTRY,
785 ADDRESS1,
786 ADDRESS2,
787 CITY,
788 COUNTY,
789 STATE,
790 PROVINCE,
791 POSTAL_CODE,
792 -- TIME_ZONE,
793 EMAIL_ADDRESS,
794 PHONE_COUNTRY_CODE,
795 PHONE_AREA_CODE,
796 PHONE_NUMBER,
797 PHONE_EXTENTION,
798 -- PERSON_PRE_NAME_ADJUNCT,
799 SALUTATION,
800 ADDRESS3 ,
801 ADDRESS4 ,
802 ADDRESS_LINES_PHONETIC ,
803 -- APARTMENT_FLAG ,
804 -- bug 4641591: columns obsolete
805 -- PO_BOX_NUMBER ,
806 -- HOUSE_NUMBER ,
807 -- STREET_SUFFIX ,
808 -- SECONDARY_SUFFIX_ELEMENT ,
809 -- STREET ,
810 -- RURAL_ROUTE_TYPE ,
811 -- RURAL_ROUTE_NUMBER ,
812 -- STREET_NUMBER ,
813 -- FLOOR ,
814 -- SUITE ,
815 POSTAL_PLUS4_CODE ,
816 -- OVERSEAS_ADDRESS_FLAG ,
817 identifying_address_flag ,
818 party_id ,
819 PERSON_LAST_NAME_PHONETIC,
820 PERSON_FIRST_NAME_PHONETIC ,
821 --PREFERRED_NAME,
822 URL,-- replace PREFERRED_NAME with URL
823 SECOND_TITLE,
824 -- DATE_OF_BIRTH,
825 -- to_date(DATE_OF_BIRTH,'MM/DD/YYYY'),
826 DATE_OF_BIRTH,
827 PERSON_ACADEMIC_TITLE,
828 PERSON_PREVIOUS_TITLE_NAME,
829 PERSON_KNOWN_AS,
830 PERSON_KNOWN_AS2,
831 PERSON_KNOWN_AS3,
832 PERSON_KNOWN_AS4,
833 PERSON_KNOWN_AS5,
834 PERSON_NAME_PHONETIC,
835 MIDDLE_NAME_PHONETIC,
836 FISCAL_CODE,
837 PLACE_OF_BIRTH,
838 DATE_OF_DEATH,
839 -- to_date(DATE_OF_DEATH,'MM/DD/YYYY'),
840 DECLARED_ETHNICITY,
841 MARITAL_STATUS, PERSONAL_INCOME,
842 -- to_date(MARITAL_STATUS_EFFECTIVE_DATE,'MM/DD/YYYY'),
843 MARITAL_STATUS_EFFECTIVE_DATE,
844 HEAD_OF_HOUSEHOLD_FLAG,
845 HOUSEHOLD_SIZE, LOCATION_DIRECTIONS,
846 ADDRESS_EFFECTIVE_DATE, ADDRESS_EXPIRATION_DATE,
847 PERSON_ATTRIBUTE1, PERSON_ATTRIBUTE2,
848 PERSON_ATTRIBUTE3, PERSON_ATTRIBUTE4,
849 PERSON_ATTRIBUTE5, PERSON_ATTRIBUTE6,
850 PERSON_ATTRIBUTE7, PERSON_ATTRIBUTE8,
851 PERSON_ATTRIBUTE9, PERSON_ATTRIBUTE10,
852 PERSON_ATTRIBUTE11, PERSON_ATTRIBUTE12,
853 PERSON_ATTRIBUTE13, PERSON_ATTRIBUTE14,
854 PERSON_ATTRIBUTE15, ADDRESS_ATTRIBUTE1,
855 ADDRESS_ATTRIBUTE2, ADDRESS_ATTRIBUTE3,
856 ADDRESS_ATTRIBUTE4, ADDRESS_ATTRIBUTE5,
857 ADDRESS_ATTRIBUTE6, ADDRESS_ATTRIBUTE7,
858 ADDRESS_ATTRIBUTE8, ADDRESS_ATTRIBUTE9,
859 ADDRESS_ATTRIBUTE10, ADDRESS_ATTRIBUTE11,
860 ADDRESS_ATTRIBUTE12, ADDRESS_ATTRIBUTE13,
861 ADDRESS_ATTRIBUTE14, ADDRESS_ATTRIBUTE15,
862 FAX_COUNTRY_CODE, FAX_AREA_CODE,
863 FAX_NUMBER,
864 PERSON_ATTRIBUTE_CATEGORY,
865 ADDRESS_ATTRIBUTE_CATEGORY ,
866 SHORT_DESCRIPTION,
867 DESCRIPTION,
868 PARTY_SITE_USE,
869 notes,
870 VEHICLE_RESPONSE_CODE ,
871 SALES_AGENT_EMAIL_ADDRESS,
872 ORIG_SYSTEM_REFERENCE,
873 TAX_REFERENCE,
874 RENT_OWNED_INDICATOR,
875 gender,
876 HOUSEHOLD_INCOME,
877 phone_type,
878 -- sranka changes done for COLT Enhancements 7/15/2003
879 PS_ATTRIBUTE_CATEGORY,
880 PS_ATTRIBUTE1,
881 PS_ATTRIBUTE2,
882 PS_ATTRIBUTE3,
883 PS_ATTRIBUTE4,
884 PS_ATTRIBUTE5,
885 PS_ATTRIBUTE6,
886 PS_ATTRIBUTE7,
887 PS_ATTRIBUTE8,
888 PS_ATTRIBUTE9,
889 PS_ATTRIBUTE10,
890 PS_ATTRIBUTE11,
891 PS_ATTRIBUTE12,
892 PS_ATTRIBUTE13,
893 PS_ATTRIBUTE14,
894 PS_ATTRIBUTE15,
895 PS_ATTRIBUTE16,
896 PS_ATTRIBUTE17,
897 PS_ATTRIBUTE18,
898 PS_ATTRIBUTE19,
899 PS_ATTRIBUTE20,
900 NATIVE_LANGUAGE,
901 PERSON_ATTRIBUTE16,
902 PERSON_ATTRIBUTE17,
903 PERSON_ATTRIBUTE18,
904 PERSON_ATTRIBUTE19,
905 PERSON_ATTRIBUTE20,
906 PERSON_ATTRIBUTE21,
907 PERSON_ATTRIBUTE22,
908 PERSON_ATTRIBUTE23,
909 PERSON_ATTRIBUTE24,
910 ADDRESS_ATTRIBUTE16,
911 ADDRESS_ATTRIBUTE17,
912 ADDRESS_ATTRIBUTE18,
913 ADDRESS_ATTRIBUTE19,
914 ADDRESS_ATTRIBUTE20
915 FROM AMS_HZ_B2C_MAPPING_V
916 WHERE IMPORT_LIST_HEADER_ID = P_IMPORT_LIST_HEADER_ID
917 and request_id = l_request_id
918 AND load_status in ('ACTIVE','RELOAD');
919
920
921 CURSOR vehicle_code_exists (x_vehicle_code varchar) IS
922 select 'Y' from ams_lookups where lookup_type = 'AMS_VEHICLE_RESPONSE_CODE'
923 and lookup_code = x_vehicle_code and enabled_flag = 'Y';
924
925
926 CURSOR resource_exists (x_sa_email_address varchar) IS
927 select ams.resource_id from ams_jtf_rs_emp_v ams , fnd_user fnd
928 where fnd.user_Name = upper(x_sa_email_address)
929 and fnd.user_id = ams.user_id;
930
931 cursor c_hdr_status is
932 select status_code from ams_imp_list_headers_all
933 where import_list_header_id = p_import_list_header_id;
934
935 party_rec hz_party_v2pub.party_rec_type;
936 org_rec hz_party_v2pub.organization_rec_type;
937 person_rec hz_party_v2pub.person_rec_type;
938 location_rec hz_location_v2pub.location_rec_type;
939 psite_rec hz_party_site_v2pub.party_site_rec_type;
940 psiteuse_rec hz_party_site_v2pub.party_site_use_rec_type;
941 cpoint_rec hz_contact_point_v2pub.contact_point_rec_type;
942 email_rec hz_contact_point_v2pub.email_rec_type;
943 phone_rec hz_contact_point_v2pub.phone_rec_type;
944 fax_rec hz_contact_point_v2pub.phone_rec_type;
945 ocon_rec hz_party_contact_v2pub.org_contact_rec_type;
946 edi_rec hz_contact_point_v2pub.edi_rec_type;
947 telex_rec hz_contact_point_v2pub.telex_rec_type;
948 web_rec hz_contact_point_v2pub.web_rec_type;
949
950 org_email_rec hz_contact_point_v2pub.email_rec_type;
951 org_phone_rec hz_contact_point_v2pub.phone_rec_type;
952 org_location_rec hz_location_v2pub.location_rec_type;
953 org_psite_rec hz_party_site_v2pub.party_site_rec_type;
954 language_rec HZ_PERSON_INFO_V2PUB.person_language_rec_type;
955
956
957 begin
958
959 -- Checks if it's B2B or B2C party type.
960 OPEN b2borb2c;
961 FETCH b2borb2c into x_b2b;
962 CLOSE b2borb2c;
963 -- Checks if party_id is mapped
964 open party_mapped;
965 fetch party_mapped into G_PARTY_MAPPED;
966 close party_mapped;
967
968 FND_PROFILE.Get('CONC_REQUEST_ID', l_request_id);
969 AMS_Utility_PVT.Create_Log (
970 x_return_status => l_return_status,
971 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
972 p_log_used_by_id => p_import_list_header_id,
973 p_msg_data => 'IN import to HZ Request Id: '|| to_char(l_request_id),
974 p_msg_type => 'DEBUG');
975 -- ******************************************************
976 IF p_number_of_processes > 0 then
977 if p_number_of_processes >= 10 then
978 l_numb_of_inst := 10;
979 else
980 l_numb_of_inst := p_number_of_processes;
981 end if;
982 open c_total_recs;
983 fetch c_total_recs into l_total_recs;
984 close c_total_recs;
985 open c_hdr_status;
986 fetch c_hdr_status into l_header_status;
987 close c_hdr_status;
988 if l_header_status = 'ERROR' then
989 l_total_recs := 0;
990 i_batch_size := 0;
991 end if;
992 if l_total_recs = 0 then
993 open c_header_status;
994 fetch c_header_status into i_batch_size,l_parent_request_id;
995 close c_header_status;
996 AMS_Utility_PVT.Create_Log (
997 x_return_status => l_return_status,
998 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
999 p_log_used_by_id => p_import_list_header_id,
1000 p_msg_data => 'l_parent_request_id = '|| to_char(l_parent_request_id),
1001 p_msg_type => 'DEBUG'
1002 );
1003 if l_request_id = l_parent_request_id then
1004 AMS_Utility_PVT.Create_Log (
1005 x_return_status => l_ret_status,
1006 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1007 p_log_used_by_id => p_import_list_header_id,
1008 p_msg_data => 'Stop processing size = '||to_char(i_batch_size),
1009 p_msg_type => 'DEBUG'
1010 );
1011 if i_batch_size < 1 then
1012
1013 --TCA mandate: bug 4587049
1014 --Enable/restore TCA events status
1015 --g_prof := fnd_profile.value('HZ_EXECUTE_API_CALLOUTS');
1016 AMS_Utility_PVT.Create_Log (
1017 x_return_status => l_return_status,
1018 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1019 p_log_used_by_id => p_import_list_header_id,
1020 p_msg_data => 'Restoring g_prof HZ_EXECUTE_API_CALLOUTS: '|| g_prof,
1021 p_msg_type => 'DEBUG');
1022
1023 if g_prof <> 'N' then
1024 fnd_profile.put('HZ_EXECUTE_API_CALLOUTS',g_prof);
1025 end if;
1026
1027 update_cust_import_status(p_import_list_header_id);
1028 end if;
1029 AMS_Utility_PVT.Create_Log (
1030 x_return_status => l_return_status,
1031 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1032 p_log_used_by_id => p_import_list_header_id,
1033 p_msg_data => 'AMSILHZC ----- no records to process ZERO not submittng any child request.',
1034 p_msg_type => 'DEBUG'
1035 );
1036 return;
1037 end if;
1038 ELSE
1039 l_req_data := fnd_conc_global.request_data;
1040 /*
1041 AMS_Utility_PVT.Create_Log (
1042 x_return_status => l_return_status,
1043 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1044 p_log_used_by_id => p_import_list_header_id,
1045 p_msg_data => 'l_req_data : '|| l_req_data,
1046 p_msg_type => 'DEBUG');
1047 */
1048 if (l_req_data is not null) then
1049 l_req_data_counter := to_number(l_req_data);
1050 l_req_data_counter := l_req_data_counter + 1;
1051 else
1052 l_req_data_counter := 1;
1053 end if;
1054 /*
1055 AMS_Utility_PVT.Create_Log (
1056 x_return_status => l_return_status,
1057 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1058 p_log_used_by_id => p_import_list_header_id,
1059 p_msg_data => 'l_req_data_counter : '|| to_char(l_req_data_counter),
1060 p_msg_type => 'DEBUG');
1061 */
1062 end if; -- if l_total_recs = 0 then
1063
1064 if l_numb_of_inst = 1 then
1065 l_batch_size := l_total_recs;
1066 else
1067 l_batch_size := ROUND(l_total_recs / l_numb_of_inst) + 1;
1068 end if;
1069
1070 AMS_Utility_PVT.Create_Log (
1071 x_return_status => l_return_status,
1072 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1073 p_log_used_by_id => p_import_list_header_id,
1074 p_msg_data => 'l_batch_size : '|| to_char(l_batch_size),
1075 p_msg_type => 'DEBUG');
1076
1077 if l_numb_of_inst > l_total_recs then
1078 l_numb_of_inst := l_total_recs;
1079 end if;
1080 if l_numb_of_inst > 10 then
1081 l_numb_of_inst := 10;
1082 end if;
1083 update ams_imp_list_headers_all set BATCH_SIZE = l_numb_of_inst,
1084 parent_request_id = l_request_id
1085 where import_list_header_id = p_import_list_header_id;
1086 commit;
1087
1088 AMS_Utility_PVT.Create_Log (
1089 x_return_status => l_return_status,
1090 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1091 p_log_used_by_id => p_import_list_header_id,
1092 p_msg_data => 'l_numb_of_inst : '|| to_char(l_numb_of_inst),
1093 p_msg_type => 'DEBUG');
1094
1095 --TCA mandate: bug 4587049
1096 --Disable TCA events just before starting list import child to process TCA data
1097 --g_prof := fnd_profile.value('HZ_EXECUTE_API_CALLOUTS');
1098 AMS_Utility_PVT.Create_Log (
1099 x_return_status => l_return_status,
1100 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1101 p_log_used_by_id => p_import_list_header_id,
1102 p_msg_data => 'Disabling g_prof HZ_EXECUTE_API_CALLOUTS: '|| g_prof,
1103 p_msg_type => 'DEBUG');
1104
1105 if g_prof <> 'N' then
1106 fnd_profile.put('HZ_EXECUTE_API_CALLOUTS','N');
1107 end if;
1108
1109 FOR loop_counter IN 1..l_numb_of_inst LOOP
1110 new_request_id := FND_REQUEST.SUBMIT_REQUEST (
1111 application => 'AMS',
1112 program => 'AMSILHZC',
1113 description => 'List Import Child Req ' || to_char(loop_counter),
1114 sub_request => TRUE,
1115 argument1 => p_import_list_header_id,
1116 argument2 => 0);
1117
1118 AMS_Utility_PVT.Create_Log (
1119 x_return_status => l_return_status,
1120 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1121 p_log_used_by_id => p_import_list_header_id,
1122 p_msg_data => 'List Import Child Req : -- concurrent program_id is '||to_char(new_request_id),
1123 p_msg_type => 'DEBUG'
1124 );
1125 IF new_request_id = 0 THEN
1126 -- RAISE FND_API.g_exc_unexpected_error;
1127 AMS_Utility_PVT.Create_Log (
1128 x_return_status => l_return_status,
1129 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1130 p_log_used_by_id => p_import_list_header_id,
1131 p_msg_data => 'List Import Child Req : Error in submitting request',
1132 p_msg_type => 'DEBUG'
1133 );
1134 end if;
1135
1136 update ams_imp_source_lines
1137 set request_id = new_request_id
1138 where import_list_header_id = p_import_list_header_id
1139 and request_id is null
1140 and load_status in ('ACTIVE','RELOAD')
1141 and ROWNUM <= l_batch_size;
1142 commit;
1143 /*
1144 if x_b2b = 'Y' then
1145 org_party_update(
1146 p_import_list_header_id,
1147 new_request_id,
1148 l_batch_size,
1149 x_return_status ,
1150 x_msg_count ,
1151 x_msg_data );
1152 else
1153 update ams_imp_source_lines
1154 set request_id = new_request_id
1155 where import_list_header_id = p_import_list_header_id
1156 and request_id is null
1157 and ROWNUM <= l_batch_size;
1158 end if;
1159 */
1160 END LOOP;
1161 /*
1162 AMS_Utility_PVT.Create_Log (
1163 x_return_status => l_return_status,
1164 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1165 p_log_used_by_id => p_import_list_header_id,
1166 p_msg_data => 'Start child prog pause --l_req_data_counter= '||to_char(l_req_data_counter),
1167 p_msg_type => 'DEBUG');
1168 */
1169 fnd_conc_global.set_req_globals(conc_status => 'PAUSED',
1170 request_data => to_char(l_req_data_counter));
1171
1172 /*
1173 AMS_Utility_PVT.Create_Log (
1174 x_return_status => l_return_status,
1175 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1176 p_log_used_by_id => p_import_list_header_id,
1177 p_msg_data => 'End AMSILHZC '||to_char(sysdate),
1178 p_msg_type => 'DEBUG');
1179 */
1180 ELSIF p_number_of_processes = 0 THEN
1181
1182 update ams_imp_list_headers_all set BATCH_SIZE = BATCH_SIZE - 1
1183 where import_list_header_id = p_import_list_header_id;
1184 commit;
1185
1186
1187 -- *****************************************************
1188
1189 if x_b2b = 'B2B' then
1190 AMS_Utility_PVT.Create_Log (
1191 x_return_status => l_ret_status,
1192 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1193 p_log_used_by_id => p_import_list_header_id,
1194 p_msg_data => 'TCA import -- Start b2b customer import',
1195 p_msg_type => 'DEBUG'
1196 );
1197
1198 OPEN b2b;
1199 LOOP
1200 FETCH b2b into
1201 -- sranka 1/14/2003
1202 -- added l_import_source_line_id to put the correct val of the import_source_line_id
1203 l_import_source_line_id,
1204 org_rec.organization_name,
1205 org_rec.fiscal_yearend_month,
1206 org_rec.duns_number_c,
1207 org_rec.employees_total,
1208 org_rec.line_of_business,
1209 org_rec.year_established,
1210 org_rec.tax_reference,
1211 org_rec.ceo_name,
1212 person_rec.person_first_name,
1213 person_rec.person_middle_name,
1214 person_rec.person_last_name,
1215 person_rec.person_name_suffix,
1216 person_rec.person_pre_name_adjunct,
1217 -- person_rec.best_time_contact_begin,
1218 -- person_rec.best_time_contact_end,
1219 location_rec.country,
1220 location_rec.address1,
1221 location_rec.address2,
1222 location_rec.city,
1223 location_rec.county,
1224 location_rec.state,
1225 location_rec.province,
1226 location_rec.postal_code,
1227 -- location_rec.time_zone,
1228 email_rec.email_address,
1229 phone_rec.phone_country_code,
1230 phone_rec.phone_area_code,
1231 phone_rec.phone_number,
1232 phone_rec.phone_extension,
1233 ocon_rec.department,
1234 ocon_rec.job_title,
1235 ocon_rec.job_title_code, -- 5033551
1236 ocon_rec.decision_maker_flag,
1237 org_rec.sic_code,
1238 org_rec.sic_code_type,
1239 -- org_rec.party_rec.TOTAL_NUM_OF_ORDERS,
1240 -- org_rec.party_rec.TOTAL_ORDERED_AMOUNT,
1241 -- org_rec.party_rec.LAST_ORDERED_DATE,
1242 org_rec.analysis_fy,
1243 org_rec.CURR_FY_POTENTIAL_REVENUE,
1244 org_rec.NEXT_FY_POTENTIAL_REVENUE,
1245 org_rec.GSA_INDICATOR_FLAG,
1246 org_rec.MISSION_STATEMENT,
1247 org_rec.ORGANIZATION_NAME_PHONETIC,
1248 org_rec.party_rec.CATEGORY_CODE,
1249 org_rec.JGZZ_FISCAL_CODE,
1250 -- org_rec.TAX_NAME,
1251 location_rec.ADDRESS3,
1252 location_rec.ADDRESS4,
1253 location_rec.ADDRESS_LINES_PHONETIC,
1254 -- location_rec.APARTMENT_FLAG,
1255 -- bug 4641591: columns obsolete
1256 -- location_rec.PO_BOX_NUMBER,
1257 -- location_rec.HOUSE_NUMBER,
1258 -- location_rec.STREET_SUFFIX,
1259 -- location_rec.SECONDARY_SUFFIX_ELEMENT,
1260 -- location_rec.STREET,
1261 -- location_rec.RURAL_ROUTE_TYPE,
1262 -- location_rec.RURAL_ROUTE_NUMBER,
1263 -- location_rec.STREET_NUMBER,
1264 -- location_rec.FLOOR,
1265 -- location_rec.SUITE,
1266 location_rec.POSTAL_PLUS4_CODE,
1267 -- location_rec.OVERSEAS_ADDRESS_FLAG,
1268 psite_rec.identifying_address_flag,
1269 l_b2b_party_id,
1270 location_rec.address_effective_date,
1271 location_rec.address_expiration_date,
1272 --ANNUAL_REVENUE,
1273 --ANNUAL_REVENUE_CURRENCY,
1274 org_rec.branch_flag,
1275 org_rec.line_of_business,
1276 org_rec.business_scope,
1277 org_rec.ceo_title,
1278 org_rec.cong_dist_code,
1279 org_rec.control_yr,
1280 org_rec.corporation_class,
1281 org_rec.credit_score,
1282 org_rec.credit_score_commentary,
1283 --CUSTOMER_CATEGORY,
1284 org_rec.db_rating,
1285 person_rec.date_of_birth,
1286 person_rec.date_of_death,
1287 org_rec.debarments_count,
1288 org_rec.debarments_date,
1289 person_rec.declared_ethnicity,
1290 org_rec.debarment_ind,
1291 location_rec.description,
1292 org_rec.disadv_8a_ind,
1293 org_rec.enquiry_duns,
1294 org_rec.export_ind,
1295 org_rec.failure_score,
1296 org_rec.failure_score_commentary,
1297 org_rec.failure_score_natnl_percentile,
1298 org_rec.failure_score_override_code,
1299 --FISCAL_CODE,
1300 org_rec.global_failure_score,
1301 org_rec.hq_branch_ind,
1302 person_rec.head_of_household_flag,
1303 person_rec.household_size,
1304 org_rec.import_ind,
1305 org_rec.known_as,
1306 org_rec.known_as2,
1307 org_rec.known_as3,
1308 org_rec.known_as4,
1309 org_rec.known_as5,
1310 person_rec.known_as,
1311 person_rec.known_as2,
1312 person_rec.known_as3,
1313 person_rec.known_as4,
1314 person_rec.known_as5,
1315 org_rec.labor_surplus_ind,
1316 org_rec.local_activity_code,
1317 org_rec.local_activity_code_type,
1318 location_rec.location_directions,
1319 --LOCATION_STATUS,
1320 person_rec.marital_status,
1321 person_rec.marital_status_effective_date,
1322 org_rec.minority_owned_ind,
1323 org_rec.minority_owned_type,
1324 --ORGANIZATION_ALIAS,
1325 org_rec.organization_type,
1326 web_rec.url,
1327 org_rec.oob_ind,
1328 person_rec.personal_income,
1329 person_rec.person_academic_title,
1330 person_rec.person_first_name_phonetic,
1331 person_rec.person_last_name_phonetic,
1332 person_rec.middle_name_phonetic,
1333 person_rec.person_name_phonetic,
1334 person_rec.person_previous_last_name, --modify ak
1335 person_rec.place_of_birth,
1336 --PREFERRED_NAME,
1337 org_rec.principal_name,
1338 org_rec.principal_title,
1339 org_rec.public_private_ownership_flag,
1340 org_rec.rent_own_ind,
1341 --RENT_OWNER_INDICATOR,
1342 person_rec.person_academic_title,
1343 location_rec.short_description,
1344 org_rec.small_bus_ind,
1345 -- person_rec.tax_reference,
1346 org_rec.woman_owned_ind,
1347 org_rec.party_rec.attribute1,
1348 org_rec.party_rec.attribute2,
1349 org_rec.party_rec.attribute3,
1350 org_rec.party_rec.attribute4,
1351 org_rec.party_rec.attribute5,
1352 org_rec.party_rec.attribute6,
1353 org_rec.party_rec.attribute7,
1354 org_rec.party_rec.attribute8,
1355 org_rec.party_rec.attribute9,
1356 org_rec.party_rec.attribute10,
1357 org_rec.party_rec.attribute11,
1358 org_rec.party_rec.attribute12,
1359 org_rec.party_rec.attribute13,
1360 org_rec.party_rec.attribute14,
1361 org_rec.party_rec.attribute15,
1362 person_rec.attribute1,
1363 person_rec.attribute2,
1364 person_rec.attribute3,
1365 person_rec.attribute4,
1366 person_rec.attribute5,
1367 person_rec.attribute6,
1368 person_rec.attribute7,
1369 person_rec.attribute8,
1370 person_rec.attribute9,
1371 person_rec.attribute10,
1372 person_rec.attribute11,
1373 person_rec.attribute12,
1374 person_rec.attribute13,
1375 person_rec.attribute14,
1376 person_rec.attribute15,
1377 ocon_rec.attribute1,
1378 ocon_rec.attribute2,
1379 ocon_rec.attribute3,
1380 ocon_rec.attribute4,
1381 ocon_rec.attribute5,
1382 ocon_rec.attribute6,
1383 ocon_rec.attribute7,
1384 ocon_rec.attribute8,
1385 ocon_rec.attribute9,
1386 ocon_rec.attribute10,
1387 ocon_rec.attribute11,
1388 ocon_rec.attribute12,
1389 ocon_rec.attribute13,
1390 ocon_rec.attribute14,
1391 ocon_rec.attribute15,
1392 location_rec.attribute1,
1393 location_rec.attribute2,
1394 location_rec.attribute3,
1395 location_rec.attribute4,
1396 location_rec.attribute5,
1397 location_rec.attribute6,
1398 location_rec.attribute7,
1399 location_rec.attribute8,
1400 location_rec.attribute9,
1401 location_rec.attribute10,
1402 location_rec.attribute11,
1403 location_rec.attribute12,
1404 location_rec.attribute13,
1405 location_rec.attribute14,
1406 location_rec.attribute15,
1407 fax_rec.phone_country_code,
1408 fax_rec.phone_area_code,
1409 fax_rec.phone_number,
1410 org_rec.party_rec.attribute_category,
1411 person_rec.attribute_category,
1412 ocon_rec.attribute_category,
1413 location_rec.attribute_category,
1414 psiteuse_rec.site_use_type,
1415 x_notes,
1416 l_vr_code,
1417 l_sa_email,
1418 org_rec.party_rec.orig_system_reference,
1419 -- sranka 3/4/2003
1420 -- made changes for supporting EMPLOYEE_OF" relationship
1421 ocon_rec.party_rel_rec.relationship_type,
1422 ocon_rec.party_rel_rec.relationship_code,
1423 org_email_rec.email_address,
1424 org_phone_rec.phone_country_code,
1425 org_phone_rec.phone_area_code,
1426 org_phone_rec.phone_number,
1427 org_phone_rec.phone_extension,
1428 org_phone_rec.phone_line_type,
1429 phone_rec.phone_line_type,
1430
1431 org_location_rec.country,
1432 org_location_rec.address1,
1433 org_location_rec.address2,
1434 org_location_rec.address3,
1435 org_location_rec.address4,
1436 org_location_rec.city,
1437 org_location_rec.county,
1438 org_location_rec.state,
1439 org_location_rec.province,
1440 org_location_rec.postal_code,
1441 org_location_rec.attribute_category,
1442 org_location_rec.attribute1,
1443 org_location_rec.attribute2,
1444 org_location_rec.attribute3,
1445 org_location_rec.attribute4,
1446 org_location_rec.attribute5,
1447 org_location_rec.attribute6,
1448 org_location_rec.attribute7,
1449 org_location_rec.attribute8,
1450 org_location_rec.attribute9,
1451 org_location_rec.attribute10,
1452 org_location_rec.attribute11,
1453 org_location_rec.attribute12,
1454 org_location_rec.attribute13,
1455 org_location_rec.attribute14,
1456 org_location_rec.attribute15,
1457 org_location_rec.attribute16,
1458 org_location_rec.attribute17,
1459 org_location_rec.attribute18,
1460 org_location_rec.attribute19,
1461 org_location_rec.attribute20,
1462 org_psite_rec.attribute_category,
1463 org_psite_rec.attribute1,
1464 org_psite_rec.attribute2,
1465 org_psite_rec.attribute3,
1466 org_psite_rec.attribute4,
1467 org_psite_rec.attribute5,
1468 org_psite_rec.attribute6,
1469 org_psite_rec.attribute7,
1470 org_psite_rec.attribute8,
1471 org_psite_rec.attribute9,
1472 org_psite_rec.attribute10,
1473 org_psite_rec.attribute11,
1474 org_psite_rec.attribute12,
1475 org_psite_rec.attribute13,
1476 org_psite_rec.attribute14,
1477 org_psite_rec.attribute15,
1478 org_psite_rec.attribute16,
1479 org_psite_rec.attribute17,
1480 org_psite_rec.attribute18,
1481 org_psite_rec.attribute19,
1482 org_psite_rec.attribute20,
1483 psite_rec.attribute_category,
1484 psite_rec.attribute1,
1485 psite_rec.attribute2,
1486 psite_rec.attribute3,
1487 psite_rec.attribute4,
1488 psite_rec.attribute5,
1489 psite_rec.attribute6,
1490 psite_rec.attribute7,
1491 psite_rec.attribute8,
1492 psite_rec.attribute9,
1493 psite_rec.attribute10,
1494 psite_rec.attribute11,
1495 psite_rec.attribute12,
1496 psite_rec.attribute13,
1497 psite_rec.attribute14,
1498 psite_rec.attribute15,
1499 psite_rec.attribute16,
1500 psite_rec.attribute17,
1501 psite_rec.attribute18,
1502 psite_rec.attribute19,
1503 psite_rec.attribute20,
1504 language_rec.language_name,
1505 org_rec.party_rec.attribute16,
1506 org_rec.party_rec.attribute17,
1507 org_rec.party_rec.attribute18,
1508 org_rec.party_rec.attribute19,
1509 org_rec.party_rec.attribute20,
1510 org_rec.party_rec.attribute21,
1511 org_rec.party_rec.attribute22,
1512 org_rec.party_rec.attribute23,
1513 org_rec.party_rec.attribute24,
1514 person_rec.attribute16,
1515 person_rec.attribute17,
1516 person_rec.attribute18,
1517 person_rec.attribute19,
1518 person_rec.attribute20,
1519 --person_rec.attribute21,
1520 --person_rec.attribute22,
1521 --person_rec.attribute23,
1522 --person_rec.attribute24,
1523 ocon_rec.attribute16,
1524 ocon_rec.attribute17,
1525 ocon_rec.attribute18,
1526 ocon_rec.attribute19,
1527 ocon_rec.attribute20,
1528 ocon_rec.attribute21,
1529 ocon_rec.attribute22,
1530 ocon_rec.attribute23,
1531 ocon_rec.attribute24,
1532 location_rec.attribute16,
1533 location_rec.attribute17,
1534 location_rec.attribute18,
1535 location_rec.attribute19,
1536 location_rec.attribute20 ;
1537
1538
1539
1540
1541 person_rec.party_rec.attribute1 := ocon_rec.attribute1;
1542 person_rec.party_rec.attribute2 := ocon_rec.attribute2;
1543 person_rec.party_rec.attribute3 := ocon_rec.attribute3;
1544 person_rec.party_rec.attribute4 := ocon_rec.attribute4;
1545 person_rec.party_rec.attribute5 := ocon_rec.attribute5;
1546 person_rec.party_rec.attribute6 := ocon_rec.attribute6;
1547 person_rec.party_rec.attribute7 := ocon_rec.attribute7;
1548 person_rec.party_rec.attribute8 := ocon_rec.attribute8;
1549 person_rec.party_rec.attribute9 := ocon_rec.attribute9;
1550 person_rec.party_rec.attribute10 := ocon_rec.attribute10;
1551 person_rec.party_rec.attribute11 := ocon_rec.attribute11;
1552 person_rec.party_rec.attribute12 := ocon_rec.attribute12;
1553 person_rec.party_rec.attribute13 := ocon_rec.attribute13;
1554 person_rec.party_rec.attribute14 := ocon_rec.attribute14;
1555 person_rec.party_rec.attribute15 := ocon_rec.attribute15;
1556 person_rec.party_rec.attribute_category:= ocon_rec.attribute_category;
1557
1558 -- hbandi code change for the Bug # 7498992
1559 person_rec.party_rec.attribute16 := ocon_rec.attribute16;
1560 person_rec.party_rec.attribute17 := ocon_rec.attribute17;
1561 person_rec.party_rec.attribute18 := ocon_rec.attribute18;
1562 person_rec.party_rec.attribute19 := ocon_rec.attribute19;
1563 person_rec.party_rec.attribute20 := ocon_rec.attribute20;
1564 person_rec.party_rec.attribute21 := ocon_rec.attribute21;
1565 person_rec.party_rec.attribute22 := ocon_rec.attribute22;
1566 person_rec.party_rec.attribute23 := ocon_rec.attribute23;
1567 person_rec.party_rec.attribute24 := ocon_rec.attribute24;
1568 -- End of Hbandi Code
1569
1570 if b2b%notfound then
1571 exit;
1572 end if;
1573
1574 -- sranka 1/14/2003
1575 -- made the changes to populate the correct import_source_line_id and support orig_system_reference
1576
1577 -- i_import_source_line_id := org_rec.party_rec.orig_system_reference; // Original line
1578 i_import_source_line_id := l_import_source_line_id;
1579
1580 -- TCA mandates changes: bug 4587049
1581 -- org_rec.party_rec.created_by_module := 'AMS_LIST_IMPORT';
1582 org_rec.created_by_module := 'AMS_LIST_IMPORT';
1583 person_rec.created_by_module := 'AMS_LIST_IMPORT';
1584 ocon_rec.created_by_module := 'AMS_LIST_IMPORT';
1585 language_rec.created_by_module := 'AMS_LIST_IMPORT';
1586 location_rec.created_by_module := 'AMS_LIST_IMPORT';
1587 psite_rec.created_by_module := 'AMS_LIST_IMPORT';
1588 psiteuse_rec.created_by_module := 'AMS_LIST_IMPORT';
1589 cpoint_rec.created_by_module := 'AMS_LIST_IMPORT';
1590
1591 AMS_List_Import_PUB.Create_Customer (
1592 p_api_version => 1,
1593 p_init_msg_list => 'T',
1594 p_commit => 'F',
1595 x_return_status => x_return_status,
1596 x_msg_count => x_msg_count,
1597 x_msg_data => x_msg_data,
1598 p_party_id => l_b2b_party_id,
1599 p_b2b_flag => 'Y',
1600 p_import_list_header_id => P_IMPORT_LIST_HEADER_ID,
1601 p_party_rec => party_rec,
1602 p_org_rec => org_rec,
1603 p_person_rec => person_rec,
1604 p_location_rec => location_rec,
1605 p_psite_rec => psite_rec,
1606 p_cpoint_rec => cpoint_rec,
1607 p_email_rec => email_rec,
1608 p_phone_rec => phone_rec,
1609 p_fax_rec => fax_rec,
1610 p_ocon_rec => ocon_rec,
1611 p_siteuse_rec => psiteuse_rec,
1612 p_web_rec => web_rec,
1613 x_new_party => x_new_party,
1614 p_component_name => x_component_name,
1615 l_import_source_line_id => l_import_source_line_id ,
1616 p_org_email_rec => org_email_rec,
1617 p_org_phone_rec => org_phone_rec,
1618 p_org_location_rec => org_location_rec,
1619 p_org_psite_rec => org_psite_rec,
1620 p_language_rec => language_rec
1621 );
1622
1623 if x_return_status = 'S' and x_notes is not null and l_b2b_party_id is not null then
1624 if x_notes is not null then
1625 create_list_note
1626 ( p_import_list_header_id,
1627 i_import_source_line_id,
1628 l_b2b_party_id,
1629 'PARTY' ,
1630 x_notes,
1631 x_return_status,
1632 x_msg_count ,
1633 x_msg_data );
1634 if x_return_status <> 'S' then
1635 UPDATE ams_imp_source_lines
1636 SET load_status = 'ERROR', ENABLED_FLAG = null
1637 WHERE import_source_line_id = i_import_source_line_id;
1638 AMS_List_Import_PUB.error_capture (
1639 1, 'T', 'F', null,
1640 x_return_status,
1641 x_msg_count,
1642 x_msg_data,
1643 p_import_list_header_id,
1644 i_import_source_line_id,
1645 null, null, null,null,
1646 'Error in note creation' );
1647
1648 end if;
1649 end if;
1650 end if;
1651 if l_vr_code is not null then
1652 open vehicle_code_exists(l_vr_code);
1653 fetch vehicle_code_exists into l_vr_code_exists;
1654 close vehicle_code_exists;
1655 if l_vr_code_exists is null then
1656 UPDATE ams_imp_source_lines
1657 SET load_status = 'ERROR',ENABLED_FLAG = null
1658 WHERE import_source_line_id = i_import_source_line_id;
1659 AMS_List_Import_PUB.error_capture (
1660 1,
1661 'T',
1662 'F',
1663 null,
1664 x_return_status,
1665 x_msg_count,
1666 x_msg_data,
1667 p_import_list_header_id,
1668 i_import_source_line_id,
1669 null, null, null,null,
1670 'VEHICLE_RESPONSE_CODE : Invalid value for column VEHICLE_RESPONSE_CODE');
1671 end if;
1672 end if;
1673 if l_sa_email is not null then
1674 open resource_exists (l_sa_email);
1675 fetch resource_exists into l_resource_id;
1676 close resource_exists;
1677 if l_resource_id is null then
1678 UPDATE ams_imp_source_lines
1679 SET load_status = 'ERROR',ENABLED_FLAG = null
1680 WHERE import_source_line_id = i_import_source_line_id;
1681 AMS_List_Import_PUB.error_capture (
1682 1,
1683 'T',
1684 'F',
1685 null,
1686 x_return_status,
1687 x_msg_count,
1688 x_msg_data,
1689 p_import_list_header_id,
1690 i_import_source_line_id,
1691 null, null, null,null,
1692 'SALES_AGENT_EMAIL_ADDRESS : Resource ID does not exist for this sales agent.');
1693 end if;
1694 UPDATE ams_imp_source_lines
1695 SET resource_id = l_resource_id
1696 WHERE import_source_line_id = i_import_source_line_id;
1697 end if;
1698
1699 if x_msg_count > 1 then
1700 FOR i IN 1..x_msg_count LOOP
1701 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1702 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
1703 END LOOP;
1704 x_msg_data := x_tmp_var1;
1705 END IF;
1706 errbuf := 'ERROR -'||substr(x_msg_data,1,180);
1707 if x_return_status <> 'S' then
1708 UPDATE ams_imp_source_lines
1709 SET load_status = 'ERROR',ENABLED_FLAG = null
1710 WHERE import_source_line_id = i_import_source_line_id;
1711 AMS_List_Import_PUB.error_capture (
1712 1,
1713 'T',
1714 'F',
1715 null,
1716 x_return_status,
1717 x_msg_count,
1718 x_msg_data,
1719 p_import_list_header_id,
1720 i_import_source_line_id,
1721 null,
1722 null,
1723 x_component_name,
1724 null,
1725 errbuf);
1726 if (x_return_status = 'E' and x_msg_data = 'Threshold')
1727 then
1728 exit;
1729 end if;
1730 end if;
1731 i_number_of_rows_processed := i_number_of_rows_processed + 1;
1732 i_import_source_line_id := null;
1733 x_return_status := null;
1734 x_msg_count := null;
1735 x_msg_data := null;
1736 x_new_party := null;
1737 errbuf := null;
1738 x_tmp_var := null;
1739 x_tmp_var1 := null;
1740 l_resource_id := null;
1741 l_vr_code_exists := null;
1742 END LOOP;
1743 CLOSE b2b;
1744
1745 UPDATE ams_imp_list_headers_all
1746 -- SET processed_rows = i_number_of_rows_processed
1747 SET processed_rows = nvl(processed_rows,0) + i_number_of_rows_processed
1748 WHERE import_list_header_id = p_import_list_header_id;
1749
1750 end if;
1751
1752 -- >>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<
1753 if x_b2b = 'B2C' then
1754 i_number_of_rows_processed := 0;
1755 AMS_Utility_PVT.Create_Log (
1756 x_return_status => l_ret_status,
1757 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1758 p_log_used_by_id => p_import_list_header_id,
1759 p_msg_data => 'TCA import -- Start b2c customer import',
1760 p_msg_type => 'DEBUG'
1761 );
1762
1763 OPEN b2c;
1764 LOOP
1765 AMS_Utility_PVT.Create_Log (
1766 x_return_status => l_ret_status,
1767 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1768 p_log_used_by_id => p_import_list_header_id,
1769 p_msg_data => 'before FETCH .................. ',
1770 p_msg_type => 'DEBUG'
1771 );
1772 FETCH b2c into
1773 l_import_source_line_id,
1774 person_rec.person_first_name,
1775 person_rec.person_middle_name,
1776 person_rec.person_last_name,
1777 person_rec.person_name_suffix,
1778 person_rec.person_pre_name_adjunct,
1779 -- person_rec.best_time_contact_begin,
1780 -- person_rec.best_time_contact_end,
1781 location_rec.country,
1782 location_rec.address1,
1783 location_rec.address2,
1784 location_rec.city,
1785 location_rec.county,
1786 location_rec.state,
1787 location_rec.province,
1788 location_rec.postal_code,
1789 -- location_rec.time_zone,
1790 email_rec.email_address,
1791 phone_rec.phone_country_code,
1792 phone_rec.phone_area_code,
1793 phone_rec.phone_number,
1794 phone_rec.phone_extension,
1795 -- person_rec.person_pre_name_adjunct,
1796 person_rec.party_rec.SALUTATION,
1797 location_rec.ADDRESS3,
1798 location_rec.ADDRESS4,
1799 location_rec.ADDRESS_LINES_PHONETIC,
1800 -- location_rec.APARTMENT_FLAG,
1801 -- bug 4641591: columns obsolete
1802 -- location_rec.PO_BOX_NUMBER,
1803 -- location_rec.HOUSE_NUMBER,
1804 -- location_rec.STREET_SUFFIX,
1805 -- location_rec.SECONDARY_SUFFIX_ELEMENT,
1806 -- location_rec.STREET,
1807 -- location_rec.RURAL_ROUTE_TYPE,
1808 -- location_rec.RURAL_ROUTE_NUMBER,
1809 -- location_rec.STREET_NUMBER,
1810 -- location_rec.FLOOR,
1811 -- location_rec.SUITE,
1812 location_rec.POSTAL_PLUS4_CODE,
1813 -- location_rec.OVERSEAS_ADDRESS_FLAG,
1814 psite_rec.identifying_address_flag,
1815 l_b2c_party_id,
1816 person_rec.person_last_name_phonetic,
1817 person_rec.person_first_name_phonetic,
1818 --PREFERRED_NAME,
1819 web_rec.url, -- replace PREFERRED_NAME with URL
1820 person_rec.person_academic_title,
1821 person_rec.date_of_birth,
1822 person_rec.person_academic_title,
1823 person_rec.person_previous_last_name,
1824 person_rec.known_as,
1825 person_rec.known_as2,
1826 person_rec.known_as3,
1827 person_rec.known_as4,
1828 person_rec.known_as5,
1829 person_rec.person_name_phonetic,
1830 person_rec.middle_name_phonetic,
1831 person_rec.jgzz_fiscal_code,
1832 person_rec.place_of_birth,
1833 person_rec.date_of_death,
1834 person_rec.declared_ethnicity,
1835 person_rec.marital_status,
1836 person_rec.personal_income,
1837 person_rec.marital_status_effective_date,
1838 person_rec.head_of_household_flag,
1839 person_rec.household_size,
1840 location_rec.location_directions,
1841 location_rec.address_effective_date,
1842 location_rec.address_expiration_date,
1843 person_rec.party_rec.attribute1,
1844 person_rec.party_rec.attribute2,
1845 person_rec.party_rec.attribute3,
1846 person_rec.party_rec.attribute4,
1847 person_rec.party_rec.attribute5,
1848 person_rec.party_rec.attribute6,
1849 person_rec.party_rec.attribute7,
1850 person_rec.party_rec.attribute8,
1851 person_rec.party_rec.attribute9,
1852 person_rec.party_rec.attribute10,
1853 person_rec.party_rec.attribute11,
1854 person_rec.party_rec.attribute12,
1855 person_rec.party_rec.attribute13,
1856 person_rec.party_rec.attribute14,
1857 person_rec.party_rec.attribute15,
1858 location_rec.attribute1,
1859 location_rec.attribute2,
1860 location_rec.attribute3,
1861 location_rec.attribute4,
1862 location_rec.attribute5,
1863 location_rec.attribute6,
1864 location_rec.attribute7,
1865 location_rec.attribute8,
1866 location_rec.attribute9,
1867 location_rec.attribute10,
1868 location_rec.attribute11,
1869 location_rec.attribute12,
1870 location_rec.attribute13,
1871 location_rec.attribute14,
1872 location_rec.attribute15,
1873 fax_rec.phone_country_code,
1874 fax_rec.phone_area_code,
1875 fax_rec.phone_number,
1876 person_rec.party_rec.attribute_category,
1877 location_rec.attribute_category ,
1878 location_rec.short_description,
1879 location_rec.description,
1880 psiteuse_rec.site_use_type,
1881 x_notes,
1882 l_vr_code,
1883 l_sa_email,
1884 person_rec.party_rec.orig_system_reference,
1885 person_rec.tax_reference,
1886 person_rec.rent_own_ind,
1887 person_rec.gender,
1888 person_rec.HOUSEHOLD_INCOME,
1889 phone_rec.phone_line_type,
1890 -- sranka changed for COLT Enhancement 7/15/2003
1891 psite_rec.attribute_category,
1892 psite_rec.attribute1,
1893 psite_rec.attribute2,
1894 psite_rec.attribute3,
1895 psite_rec.attribute4,
1896 psite_rec.attribute5,
1897 psite_rec.attribute6,
1898 psite_rec.attribute7,
1899 psite_rec.attribute8,
1900 psite_rec.attribute9,
1901 psite_rec.attribute10,
1902 psite_rec.attribute11,
1903 psite_rec.attribute12,
1904 psite_rec.attribute13,
1905 psite_rec.attribute14,
1906 psite_rec.attribute15,
1907 psite_rec.attribute16,
1908 psite_rec.attribute17,
1909 psite_rec.attribute18,
1910 psite_rec.attribute19,
1911 psite_rec.attribute20,
1912 language_rec.language_name,
1913 person_rec.party_rec.attribute16,
1914 person_rec.party_rec.attribute17,
1915 person_rec.party_rec.attribute18,
1916 person_rec.party_rec.attribute19,
1917 person_rec.party_rec.attribute20,
1918 person_rec.party_rec.attribute21,
1919 person_rec.party_rec.attribute22,
1920 person_rec.party_rec.attribute23,
1921 person_rec.party_rec.attribute24,
1922 location_rec.attribute16,
1923 location_rec.attribute17,
1924 location_rec.attribute18,
1925 location_rec.attribute19,
1926 location_rec.attribute20 ;
1927
1928 if b2c%notfound then
1929 exit;
1930 end if;
1931 AMS_Utility_PVT.Create_Log (
1932 x_return_status => l_ret_status,
1933 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1934 p_log_used_by_id => p_import_list_header_id,
1935 p_msg_data => 'After FETCH .................. ',
1936 p_msg_type => 'DEBUG'
1937 );
1938 -- sranka 1/17/2003
1939 -- i_import_source_line_id := person_rec.party_rec.orig_system_reference; //original
1940 i_import_source_line_id := l_import_source_line_id;
1941
1942 AMS_Utility_PVT.Create_Log (
1943 x_return_status => l_ret_status,
1944 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1945 p_log_used_by_id => p_import_list_header_id,
1946 p_msg_data => 'before Create_Customer ',
1947 p_msg_type => 'DEBUG'
1948 );
1949
1950 -- TCA mandates changes: bug 4587049
1951 -- org_rec.party_rec.created_by_module := 'AMS_LIST_IMPORT';
1952 org_rec.created_by_module := 'AMS_LIST_IMPORT';
1953 person_rec.created_by_module := 'AMS_LIST_IMPORT';
1954 ocon_rec.created_by_module := 'AMS_LIST_IMPORT';
1955 --language_rec.created_by_module := 'AMS_LIST_IMPORT';
1956 location_rec.created_by_module := 'AMS_LIST_IMPORT';
1957 psite_rec.created_by_module := 'AMS_LIST_IMPORT';
1958 psiteuse_rec.created_by_module := 'AMS_LIST_IMPORT';
1959 cpoint_rec.created_by_module := 'AMS_LIST_IMPORT';
1960
1961 AMS_List_Import_PUB.Create_Customer (
1962 p_api_version => 1,
1963 p_init_msg_list => 'T',
1964 p_commit => 'F',
1965 x_return_status => x_return_status,
1966 x_msg_count => x_msg_count,
1967 x_msg_data => x_msg_data,
1968 p_party_id => l_b2c_party_id,
1969 p_b2b_flag => 'N',
1970 p_import_list_header_id => P_IMPORT_LIST_HEADER_ID,
1971 p_party_rec => party_rec,
1972 p_org_rec => org_rec,
1973 p_person_rec => person_rec,
1974 p_location_rec => location_rec,
1975 p_psite_rec => psite_rec,
1976 p_cpoint_rec => cpoint_rec,
1977 p_email_rec => email_rec,
1978 p_phone_rec => phone_rec,
1979 p_fax_rec => fax_rec,
1980 p_ocon_rec => ocon_rec,
1981 p_siteuse_rec => psiteuse_rec,
1982 p_web_rec => web_rec,
1983 x_new_party => x_new_party,
1984 p_component_name => x_component_name,
1985 l_import_source_line_id => l_import_source_line_id
1986 );
1987
1988 AMS_Utility_PVT.Create_Log (
1989 x_return_status => l_ret_status,
1990 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1991 p_log_used_by_id => p_import_list_header_id,
1992 p_msg_data => 'after Create_Customer ' ,
1993 p_msg_type => 'DEBUG'
1994 );
1995
1996 AMS_Utility_PVT.Create_Log (
1997 x_return_status => l_ret_status,
1998 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
1999 p_log_used_by_id => p_import_list_header_id,
2000 p_msg_data => 'after Create_Customer x_return_status = '||x_return_status,
2001 p_msg_type => 'DEBUG'
2002 );
2003
2004 AMS_Utility_PVT.Create_Log (
2005 x_return_status => l_ret_status,
2006 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2007 p_log_used_by_id => p_import_list_header_id,
2008 p_msg_data => 'after Create_Customer x_msg_count = '||to_char(x_msg_count),
2009 p_msg_type => 'DEBUG'
2010 );
2011
2012 AMS_Utility_PVT.Create_Log (
2013 x_return_status => l_ret_status,
2014 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2015 p_log_used_by_id => p_import_list_header_id,
2016 p_msg_data => 'after Create_Customer x_msg_data = '||x_msg_data,
2017 p_msg_type => 'DEBUG'
2018 );
2019
2020 if x_return_status = 'S' and x_notes is not null and l_b2c_party_id is not null then
2021 if x_notes is not null then
2022 create_list_note
2023 ( p_import_list_header_id,
2024 i_import_source_line_id,
2025 l_b2c_party_id,
2026 'PARTY' ,
2027 x_notes,
2028 x_return_status,
2029 x_msg_count ,
2030 x_msg_data );
2031 if x_return_status <> 'S' then
2032 UPDATE ams_imp_source_lines
2033 SET load_status = 'ERROR',ENABLED_FLAG = null
2034 WHERE import_source_line_id = i_import_source_line_id;
2035 AMS_List_Import_PUB.error_capture (
2036 1, 'T', 'F', null,
2037 x_return_status,
2038 x_msg_count,
2039 x_msg_data,
2040 p_import_list_header_id,
2041 i_import_source_line_id,
2042 null, null, null,null,
2043 'Error in note creation' );
2044
2045 end if;
2046 end if;
2047 end if;
2048 if l_vr_code is not null then
2049 open vehicle_code_exists(l_vr_code);
2050 fetch vehicle_code_exists into l_vr_code_exists;
2051 close vehicle_code_exists;
2052 if l_vr_code_exists is null then
2053 UPDATE ams_imp_source_lines
2054 SET load_status = 'ERROR',ENABLED_FLAG = null
2055 WHERE import_source_line_id = i_import_source_line_id;
2056 AMS_List_Import_PUB.error_capture (
2057 1,
2058 'T',
2059 'F',
2060 null,
2061 x_return_status,
2062 x_msg_count,
2063 x_msg_data,
2064 p_import_list_header_id,
2065 i_import_source_line_id,
2066 null, null, null,null,
2067 'VEHICLE_RESPONSE_CODE : Invalid value for column VEHICLE_RESPONSE_CODE');
2068 end if;
2069 end if;
2070 if l_sa_email is not null then
2071 open resource_exists (l_sa_email);
2072 fetch resource_exists into l_resource_id;
2073 close resource_exists;
2074 if l_resource_id is null then
2075 UPDATE ams_imp_source_lines
2076 SET load_status = 'ERROR',ENABLED_FLAG = null
2077 WHERE import_source_line_id = i_import_source_line_id;
2078 AMS_List_Import_PUB.error_capture (
2079 1,
2080 'T',
2081 'F',
2082 null,
2083 x_return_status,
2084 x_msg_count,
2085 x_msg_data,
2086 p_import_list_header_id,
2087 i_import_source_line_id,
2088 null, null, null,null,
2089 'SALES_AGENT_EMAIL_ADDRESS : Resource ID does not exist for this sales agent.');
2090 end if;
2091 UPDATE ams_imp_source_lines
2092 SET resource_id = l_resource_id
2093 WHERE import_source_line_id = i_import_source_line_id
2094 AND import_list_header_id = p_import_list_header_id;
2095 end if;
2096
2097 if x_msg_count > 1 then
2098 FOR i IN 1..x_msg_count LOOP
2099 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2100 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
2101 END LOOP;
2102 x_msg_data := x_tmp_var1;
2103 END IF;
2104 errbuf := 'ERROR -'||substr(x_msg_data,1,180);
2105 if x_return_status <> 'S' then
2106 UPDATE ams_imp_source_lines
2107 SET load_status = 'ERROR',ENABLED_FLAG = null
2108 WHERE import_source_line_id = i_import_source_line_id;
2109 AMS_List_Import_PUB.error_capture (
2110 1,
2111 'T',
2112 'F',
2113 null,
2114 x_return_status,
2115 x_msg_count,
2116 x_msg_data,
2117 p_import_list_header_id,
2118 i_import_source_line_id,
2119 null,
2120 null,
2121 x_component_name,
2122 null,
2123 substrb(errbuf,1,2000));
2124 if (x_return_status = 'E' and x_msg_data = 'Threshold')
2125 then
2126 exit;
2127 end if;
2128 end if;
2129 i_number_of_rows_processed := i_number_of_rows_processed + 1;
2130 i_import_source_line_id := null;
2131 x_return_status := null;
2132 x_msg_count := null;
2133 x_msg_data := null;
2134 x_new_party := null;
2135 errbuf := null;
2136 x_tmp_var := null;
2137 x_tmp_var1 := null;
2138 l_resource_id := null;
2139 l_vr_code_exists := null;
2140
2141 END LOOP;
2142 CLOSE b2c;
2143
2144 UPDATE ams_imp_list_headers_all
2145 -- SET processed_rows = i_number_of_rows_processed
2146 SET processed_rows = nvl(processed_rows,0) + i_number_of_rows_processed
2147 WHERE import_list_header_id = p_import_list_header_id;
2148
2149 end if; -- b2c
2150 END IF; -- IF p_number_of_processes > 0 then
2151 /*
2152 open c_header_status;
2153 fetch c_header_status into i_batch_size,l_parent_request_id;
2154 close c_header_status;
2155 AMS_Utility_PVT.Create_Log (
2156 x_return_status => l_ret_status,
2157 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2158 p_log_used_by_id => p_import_list_header_id,
2159 p_msg_data => 'Stop processing size = '||to_char(i_batch_size),
2160 p_msg_type => 'DEBUG'
2161 );
2162 if i_batch_size < 1 then
2163 update_cust_import_status(p_import_list_header_id);
2164 end if;
2165 */
2166 errbuf:= 'TCA import Program(-)';
2167 retcode:=0;
2168 AMS_Utility_PVT.Create_Log (
2169 x_return_status => l_ret_status,
2170 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2171 p_log_used_by_id => p_import_list_header_id,
2172 p_msg_data => 'TCA import Program(-)',
2173 p_msg_type => 'DEBUG'
2174 );
2175
2176 EXCEPTION
2177 WHEN OTHERS THEN
2178 errbuf:= substr(SQLERRM,1,254);
2179 retcode:= 2;
2180 UPDATE ams_imp_source_lines
2181 SET load_status = 'ERROR'
2182 WHERE import_source_line_id = i_import_source_line_id;
2183 AMS_List_Import_PUB.error_capture (
2184 1,
2185 'T',
2186 'F',
2187 null,
2188 x_return_status,
2189 x_msg_count,
2190 x_msg_data,
2191 p_import_list_header_id,
2192 nvl(i_import_source_line_id,0),
2193 null, null, null,null,
2194 'Error in TCA load program ' || SQLERRM||' '||SQLCODE);
2195 l_lookup_code := 'ERROR';
2196 l_user_status_id := null;
2197 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2198 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2199 system_status_code = 'ERROR' and default_flag = 'Y';
2200
2201 UPDATE ams_imp_list_headers_all
2202 set status_code = l_lookup_code,
2203 user_status_id = l_user_status_id,
2204 status_date = sysdate
2205 where import_list_header_id = p_import_list_header_id;
2206 commit;
2207 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
2208 FND_MESSAGE.Set_Token('ROW','Error in TCA load program ' || SQLERRM||' '||SQLCODE);
2209 AMS_Utility_PVT.Create_Log (
2210 x_return_status => l_return_status,
2211 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2212 p_log_used_by_id => p_import_list_header_id,
2213 p_msg_data => FND_MESSAGE.get,
2214 p_msg_type => 'DEBUG'
2215 );
2216 end list_import_to_hz;
2217
2218 -- --------------------------------------------------------
2219 -- This program invokes sql*loader from concurrent program
2220 -- to populate the data from the data file to the OMO application.
2221 --
2222
2223 PROCEDURE load_to_ams(
2224 Errbuf OUT NOCOPY VARCHAR2,
2225 Retcode OUT NOCOPY VARCHAR2,
2226 p_import_list_header_id IN NUMBER, -- To be used as part of executable name.
2227 p_control_file IN VARCHAR2, -- Name of file to be used by the SQL*Loader process.
2228 p_staged_only IN VARCHAR2 , -- Used for staged table import.
2229 p_owner_user_id IN NUMBER, -- Used for list generation (resource_id),
2230 p_generate_list IN VARCHAR2 ,
2231 p_list_name IN VARCHAR2 -- For list generation name.
2232 ) IS
2233
2234 L_SQL_LOADER CONSTANT VARCHAR2(30) := 'SQL*Loader';
2235 l_short_name VARCHAR2(30);
2236 l_request_id NUMBER;
2237 l_return_status VARCHAR2(1);
2238 l_start_time DATE;
2239 l_import_list_header_name VARCHAR2(120);
2240 l_msg_count NUMBER;
2241 l_msg_data VARCHAR2(2000);
2242 l_msg_buf VARCHAR2(4000);
2243 l_phase VARCHAR2(30);
2244 l_status VARCHAR2(30);
2245 l_dev_phase VARCHAR2(30);
2246 l_dev_status VARCHAR2(30);
2247 l_message VARCHAR2(240);
2248 l_wait_status BOOLEAN;
2249 l_loaded_rows NUMBER;
2250 l_post_request_id NUMBER;
2251 l_server_flag VARCHAR2(1);
2252 l_dedupe_flag VARCHAR2(1);
2253 l_status_code VARCHAR2(30);
2254 l_st_code VARCHAR2(30);
2255 l_lookup_code VARCHAR2(30);
2256 i_msg_count NUMBER;
2257 i_return_status VARCHAR2(1);
2258 i_msg_data VARCHAR2(2000);
2259 i_msg_buf VARCHAR2(4000);
2260 l_list_header_id NUMBER;
2261 l_duplicate_records NUMBER;
2262 l_user_status_id NUMBER;
2263 l_imp_type VARCHAR2(30);
2264 l_finish_status VARCHAR2(30);
2265 l_execute_mode VARCHAR2(1);
2266 l_batch_id NUMBER;
2267 l_rec_in_stag_tab VARCHAR2(1);
2268 l_load_rows NUMBER;
2269 l_total_records NUMBER;
2270 l_mesg_text VARCHAR2(2000);
2271 x_import_list_header_id number;
2272 X_RETURN_STATUS VARCHAR2(1);
2273 x_msg_count NUMBER;
2274 x_msg_data VARCHAR2(2000);
2275 x_hz_dup_check VARCHAR2(60);
2276 l_b2b_flag VARCHAR2(1);
2277 l_osr_mapped VARCHAR2(1);
2278
2279 CURSOR c_loaded_rows IS
2280 SELECT COUNT(*)
2281 FROM ams_imp_source_lines
2282 WHERE import_list_header_id = p_import_list_header_id;
2283
2284 cursor c_header_name is
2285 select name, server_flag, status_code, import_type, execute_mode from ams_imp_list_headers_all
2286 where import_list_header_id = p_import_list_header_id;
2287
2288 cursor c_status is
2289 select status_code, nvl(dedupe_flag,'N') from ams_imp_list_headers_all
2290 where import_list_header_id = p_import_list_header_id;
2291
2292 cursor c_dup_recs is
2293 select count(*) from ams_imp_source_lines
2294 where import_list_header_id = p_import_list_header_id
2295 and duplicate_flag = 'Y';
2296
2297 cursor c_loaded_rows_for_lead IS
2298 SELECT COUNT(*) FROM ams_imp_source_lines
2299 WHERE import_list_header_id = p_import_list_header_id;
2300
2301 cursor c_rec_in_stag_tab is
2302 select 'Y' from ams_imp_source_lines
2303 where import_list_header_id = p_import_list_header_id
2304 and load_status in ('ACTIVE','RELOAD')
2305 and rownum < 2;
2306
2307 cursor c_total_records is
2308 select count(*) from ams_imp_source_lines
2309 where import_list_header_id = p_import_list_header_id
2310 and load_status in ('ACTIVE','RELOAD');
2311
2312 -- For Mapped osr
2313 cursor osr_mapped is
2314 SELECT 'Y' FROM ams_list_src_fields sf,
2315 ams_imp_list_headers_all hd
2316 WHERE sf.field_column_name = 'ORIG_SYSTEM_REFERENCE'
2317 AND sf.enabled_flag = 'Y'
2318 AND sf.list_source_type_id = hd.list_source_type_id
2319 and hd.import_type in ('B2B','B2C')
2320 AND hd.import_list_header_id = p_import_list_header_id;
2321 BEGIN
2322
2323 --
2324 -- For SQL*Loader programs, the executable file name is equivalent to the
2325 -- control file. The field "Executable" on the screen is the same as "program"
2326 -- in the API. We will use the short name for both program and program short name.
2327 --
2328 l_short_name := 'AMS' || FND_GLOBAL.LOGIN_ID || 'IMP' || p_import_list_header_id;
2329 x_import_list_header_id := p_import_list_header_id;
2330 x_hz_dup_check := fnd_profile.value('AMS_HZ_DEDUPE_RULE');
2331 if x_hz_dup_check <> 'Y' then
2332 x_hz_dup_check := 'N';
2333 end if;
2334
2335 --
2336 open c_header_name;
2337 fetch c_header_name into l_import_list_header_name, l_server_flag, l_status_code, l_imp_type, l_execute_mode;
2338 close c_header_name;
2339
2340 if l_execute_mode = 'R' then
2341 l_lookup_code := 'STAGED';
2342 l_status_code := 'STAGED';
2343 l_user_status_id := null;
2344 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2345 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2346 system_status_code = 'STAGED' and default_flag = 'Y';
2347
2348 select as_import_interface_s.nextval into l_batch_id from dual;
2349
2350 UPDATE ams_imp_list_headers_all
2351 set status_code = l_lookup_code,
2352 user_status_id = l_user_status_id,
2353 batch_id = l_batch_id,
2354 status_date = sysdate
2355 where import_list_header_id = p_import_list_header_id;
2356
2357 UPDATE ams_imp_source_lines
2358 set batch_id = l_batch_id,
2359 request_id = NULL
2360 where import_list_header_id = p_import_list_header_id
2361 and load_status in ('RELOAD','ACTIVE');
2362
2363
2364
2365 AMS_Utility_PVT.Create_Log (
2366 x_return_status => l_return_status,
2367 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2368 p_log_used_by_id => p_import_list_header_id,
2369 p_msg_data => 'Starting List Import in RELOAD Mode.',
2370 p_msg_type => 'DEBUG'
2371 );
2372 end if;
2373
2374 -- commented by ndadwal for Bug 5113207
2375 /* if l_status_code = 'NEW' then
2376 if l_server_flag = 'Y' then
2377 if p_staged_only = 'Y' then
2378 UPDATE ams_imp_list_headers_all
2379 set loaded_no_of_rows = l_loaded_rows,
2380 loaded_date = sysdate,
2381 status_code = 'STAGING',
2382 status_date = sysdate
2383 where import_list_header_id = p_import_list_header_id;
2384 commit;
2385 end if;
2386
2387 */
2388 -- added by ndadwal for Bug 5113207
2389 if l_status_code = 'NEW' then
2390 if l_server_flag = 'Y' then
2391 if p_staged_only = 'Y' then
2392 UPDATE ams_imp_list_headers_all
2393 set loaded_no_of_rows = l_loaded_rows,
2394 loaded_date = sysdate,
2395 status_code = 'STAGED',
2396 status_date = sysdate
2397 where import_list_header_id = p_import_list_header_id;
2398 commit;
2399 end if;
2400
2401 l_lookup_code := 'STAGED';
2402 l_user_status_id := null;
2403 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2404 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2405 system_status_code = 'STAGED' and default_flag = 'Y';
2406
2407 UPDATE ams_imp_list_headers_all
2408 set loaded_no_of_rows = l_loaded_rows,
2409 loaded_date = sysdate,
2410 status_code = l_lookup_code,
2411 user_status_id = l_user_status_id,
2412 status_date = sysdate
2413 where import_list_header_id = p_import_list_header_id;
2414 -- end ndadwal changes
2415
2416 AMS_Utility_PVT.Create_Log (
2417 x_return_status => l_return_status,
2418 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2419 p_log_used_by_id => p_import_list_header_id,
2420 p_msg_data => 'Starting SQL*LOADER program to load the data.',
2421 p_msg_type => 'DEBUG'
2422 );
2423
2424 -- Create the Executable entry.
2425 FND_PROGRAM.EXECUTABLE (
2426 executable => l_short_name,
2427 application => 'AMS',
2428 short_name => l_short_name,
2429 description => l_import_list_header_name,
2430 execution_method => L_SQL_LOADER,
2431 execution_file_name => p_control_file,
2432 language_code => USERENV ('LANG')
2433 );
2434
2435 --
2436 -- Register the concurrent program.
2437 FND_PROGRAM.REGISTER (
2438 program => l_short_name,
2439 application => 'AMS',
2440 enabled => 'Y',
2441 short_name => l_short_name,
2442 executable_short_name => l_short_name,
2443 executable_application => 'AMS',
2444 language_code => USERENV ('LANG')
2445 );
2446
2447 --
2448 -- Since this is a SQL*Loader concurrent program,
2449 -- we don't need to specify other parameters. The
2450 -- only other parameter would be the data file name,
2451 -- but we will include that in the control file.
2452 --
2453 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
2454 application => 'AMS',
2455 program => l_short_name,
2456 start_time => l_start_time
2457 );
2458
2459 IF l_request_id = 0 THEN
2460 l_mesg_text := fnd_message.get;
2461 AMS_Utility_PVT.Create_Log (
2462 x_return_status => l_return_status,
2463 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2464 p_log_used_by_id => p_import_list_header_id,
2465 p_msg_data => l_mesg_text,
2466 p_msg_type => 'DEBUG' );
2467
2468 l_user_status_id := null;
2469 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2470 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2471 system_status_code = 'ERROR' and default_flag = 'Y';
2472 UPDATE ams_imp_list_headers_all
2473 set status_code = l_lookup_code,
2474 user_status_id = l_user_status_id,
2475 status_date = sysdate
2476 where import_list_header_id = p_import_list_header_id;
2477 commit;
2478 RAISE FND_API.g_exc_unexpected_error;
2479 ELSE
2480 FND_MESSAGE.set_name ('AMS', 'AMS_IMP_LOAD_REQUEST_ID');
2481 FND_MESSAGE.set_token ('REQUEST_ID', l_request_id);
2482
2483 Ams_Utility_PVT.Create_Log (
2484 x_return_status => l_return_status,
2485 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2486 p_log_used_by_id => p_import_list_header_id,
2487 p_msg_data => FND_MESSAGE.get,
2488 p_msg_type => 'MILESTONE'
2489 );
2490 END IF;
2491 Commit;
2492 AMS_Utility_PVT.Create_Log (
2493 x_return_status => l_return_status,
2494 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2495 p_log_used_by_id => p_import_list_header_id,
2496 p_msg_data => 'SQL*LOADER -- For details Please check the log file '||p_control_file||'.log',
2497 p_msg_type => 'DEBUG'
2498 );
2499
2500 AMS_Utility_PVT.Create_Log (
2501 x_return_status => l_return_status,
2502 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2503 p_log_used_by_id => p_import_list_header_id,
2504 p_msg_data => 'SQL*LOADER -- For bad records Please check the bad file '||p_control_file||'.bad',
2505 p_msg_type => 'DEBUG'
2506 );
2507
2508
2509 --
2510
2511 -- The sql*loader concurrent program MUST finish
2512 -- before invoking the destination application
2513 -- concurrent program like TCA or LEADS.
2514 -- This is also required for the clean up process.
2515
2516 l_wait_status := FND_CONCURRENT.WAIT_FOR_REQUEST (
2517 request_id => l_request_id,
2518 phase => l_phase,
2519 status => l_status,
2520 dev_phase => l_dev_phase,
2521 dev_status => l_dev_status,
2522 message => l_message
2523 );
2524
2525 ---------------------------------------------
2526 -- WAIT_STATUS should only come back as
2527 -- TRUE. It only comes back as FALSE if
2528 -- the conc request was not successfully
2529 -- submitted.
2530 ---------------------------------------------
2531 IF NOT l_wait_status THEN
2532 l_mesg_text := fnd_message.get;
2533 AMS_Utility_PVT.Create_Log (
2534 x_return_status => l_return_status,
2535 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2536 p_log_used_by_id => p_import_list_header_id,
2537 p_msg_data => l_mesg_text,
2538 p_msg_type => 'DEBUG' );
2539
2540 l_user_status_id := null;
2541 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2542 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2543 system_status_code = 'ERROR' and default_flag = 'Y';
2544 UPDATE ams_imp_list_headers_all
2545 set status_code = l_lookup_code,
2546 user_status_id = l_user_status_id,
2547 status_date = sysdate
2548 where import_list_header_id = p_import_list_header_id;
2549 commit;
2550 RAISE FND_API.g_exc_unexpected_error;
2551 END IF;
2552
2553 ---------------------------------------------
2554 OPEN c_loaded_rows;
2555 FETCH c_loaded_rows INTO l_loaded_rows;
2556 CLOSE c_loaded_rows;
2557
2558 FND_MESSAGE.set_name ('AMS', 'AMS_IMP_LOADED_NO_ROWS');
2559 FND_MESSAGE.set_token ('NUM_ROWS', l_loaded_rows);
2560
2561 Ams_Utility_PVT.Create_Log (
2562 x_return_status => l_return_status,
2563 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2564 p_log_used_by_id => p_import_list_header_id,
2565 p_msg_data => FND_MESSAGE.get,
2566 p_msg_level => 80,
2567 p_msg_type => 'MILESTONE'
2568 );
2569
2570 l_lookup_code := 'STAGED';
2571 l_user_status_id := null;
2572 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2573 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2574 system_status_code = 'STAGED' and default_flag = 'Y';
2575
2576 UPDATE ams_imp_list_headers_all
2577 set loaded_no_of_rows = l_loaded_rows,
2578 loaded_date = sysdate,
2579 status_code = l_lookup_code,
2580 user_status_id = l_user_status_id,
2581 status_date = sysdate
2582 where import_list_header_id = p_import_list_header_id;
2583
2584 --
2585 -- Clean-up the concurrent programs which were created
2586 -- during program execution.
2587 FND_PROGRAM.DELETE_PROGRAM (
2588 program_short_name => l_short_name,
2589 application => 'AMS'
2590 );
2591
2592 --
2593 -- The "executable" will be the same as the program short name
2594 -- for all run-time generated concurrent programs. The registered
2595 -- program must be deleted before the executable can be.
2596 FND_PROGRAM.DELETE_EXECUTABLE (
2597 executable_short_name => l_short_name,
2598 application => 'AMS'
2599 );
2600 end if; -- for server_flag
2601 end if; -- for status_code
2602
2603 -- for post processing here the data is populated to the TCA and OSM
2604 -- applications using concurrent programs.
2605
2606 open c_status;
2607 fetch c_status into l_st_code, l_dedupe_flag;
2608 close c_status;
2609
2610
2611 open c_rec_in_stag_tab;
2612 fetch c_rec_in_stag_tab into l_rec_in_stag_tab;
2613 close c_rec_in_stag_tab;
2614 if l_rec_in_stag_tab is NULL then
2615 AMS_Utility_PVT.Create_Log (
2616 x_return_status => l_return_status,
2617 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2618 p_log_used_by_id => p_import_list_header_id,
2619 p_msg_data => 'Aborting import process, Staging table not populated.',
2620 p_msg_type => 'DEBUG'
2621 );
2622 l_lookup_code := 'ERROR';
2623 l_user_status_id := null;
2624 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2625 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2626 system_status_code = 'ERROR' and default_flag = 'Y';
2627
2628 UPDATE ams_imp_list_headers_all
2629 set status_code = l_lookup_code,
2630 user_status_id = l_user_status_id,
2631 status_date = sysdate
2632 where import_list_header_id = p_import_list_header_id;
2633 return;
2634 end if;
2635
2636 -- ------------------------------------------------------
2637 -- ------------RAISE PRE BUSINESS EVENT START ---------------------
2638
2639 Raise_Business_event(p_import_list_header_id,
2640 'oracle.apps.ams.list.ListImportPreEvent');
2641
2642 -- ------------RAISE PRE BUSINESS EVENT END ---------------------
2643 -- ------------------------------------------------------
2644
2645
2646 open osr_mapped;
2647 fetch osr_mapped into l_osr_mapped;
2648 close osr_mapped;
2649 -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2650 gen_transposed_phone_number( x_import_list_header_id, x_return_status,
2651 x_msg_count, x_msg_data );
2652
2653 if l_imp_type = 'B2B' then
2654 --if party_id is provided and if its of type relationship
2655 --update org_party_id and ocont_party_id
2656 update ams_hz_b2b_mapping_v b2b
2657 set (org_party_id, ocont_party_id) = (select object_id, subject_id from hz_relationships
2658 where party_id = b2b.party_id and object_type = 'ORGANIZATION'
2659 and subject_type = 'PERSON' and relationship_type = 'CONTACT'
2660 and nvl(status,'A') = 'A')
2661 where import_list_header_id = p_import_list_header_id
2662 and party_id is not null
2663 and org_party_id is null;
2664
2665 --if party_id is of type organization then update org_party_id with party_id
2666 update ams_hz_b2b_mapping_v b2b
2667 set org_party_id = party_id
2668 where import_list_header_id = p_import_list_header_id
2669 and party_id is not null
2670 and org_party_id is null;
2671
2672 update ams_hz_b2b_mapping_v
2673 set org_exist = 'Y'
2674 where import_list_header_id = p_import_list_header_id
2675 and org_party_id is not null;
2676
2677 update ams_hz_b2b_mapping_v
2678 set ocont_exist = 'Y'
2679 where import_list_header_id = p_import_list_header_id
2680 and ocont_party_id is not null;
2681
2682 elsif l_imp_type = 'B2C' then
2683
2684 --aanjaria: bug 4913239: copy party_id to person_party_id so that existence check is by passed
2685 UPDATE ams_hz_b2c_mapping_v
2686 SET person_party_id = party_id,
2687 person_exist = 'Y'
2688 WHERE import_list_header_id = p_import_list_header_id
2689 AND party_id is not null
2690 AND person_party_id is null;
2691 end if;
2692
2693 commit;
2694
2695 if x_hz_dup_check = 'Y' then
2696 if l_imp_type = 'B2B' then
2697 if l_osr_mapped = 'Y' then
2698 org_existence_checking_osr(x_import_list_header_id,
2699 x_return_status,x_msg_count,x_msg_data);
2700 end if;
2701 org_existence_checking(x_import_list_header_id,
2702 x_return_status,x_msg_count,x_msg_data);
2703 if x_return_status <> 'S' then
2704 AMS_Utility_PVT.Create_Log (
2705 x_return_status => l_return_status,
2706 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2707 p_log_used_by_id => p_import_list_header_id,
2708 p_msg_data => 'Aborting org_existence_checking.',
2709 p_msg_type => 'DEBUG');
2710 l_lookup_code := 'ERROR';
2711 l_user_status_id := null;
2712 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2713 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2714 system_status_code = 'ERROR' and default_flag = 'Y';
2715
2716 UPDATE ams_imp_list_headers_all
2717 set status_code = l_lookup_code,
2718 user_status_id = l_user_status_id,
2719 status_date = sysdate
2720 where import_list_header_id = p_import_list_header_id;
2721 return;
2722 end if;
2723
2724 if l_osr_mapped = 'Y' then
2725 org_cont_existence_chk_osr(x_import_list_header_id,
2726 x_return_status,x_msg_count,x_msg_data);
2727 end if;
2728 org_cont_existence_checking(x_import_list_header_id,
2729 x_return_status,x_msg_count,x_msg_data);
2730 if x_return_status <> 'S' then
2731 AMS_Utility_PVT.Create_Log (
2732 x_return_status => l_return_status,
2733 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2734 p_log_used_by_id => p_import_list_header_id,
2735 p_msg_data => 'Aborting org_cont_existence_checking.',
2736 p_msg_type => 'DEBUG');
2737 l_lookup_code := 'ERROR';
2738 l_user_status_id := null;
2739 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2740 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2741 system_status_code = 'ERROR' and default_flag = 'Y';
2742 UPDATE ams_imp_list_headers_all
2743 set status_code = l_lookup_code,
2744 user_status_id = l_user_status_id,
2745 status_date = sysdate
2746 where import_list_header_id = p_import_list_header_id;
2747 return;
2748 end if;
2749
2750 org_address_existence_checking(x_import_list_header_id,
2751 x_return_status,x_msg_count,x_msg_data);
2752 if x_return_status <> 'S' then
2753 AMS_Utility_PVT.Create_Log (
2754 x_return_status => l_return_status,
2755 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2756 p_log_used_by_id => p_import_list_header_id,
2757 p_msg_data => 'Aborting org_address_existence_checking.',
2758 p_msg_type => 'DEBUG');
2759 l_lookup_code := 'ERROR';
2760 l_user_status_id := null;
2761 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2762 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2763 system_status_code = 'ERROR' and default_flag = 'Y';
2764 UPDATE ams_imp_list_headers_all
2765 set status_code = l_lookup_code,
2766 user_status_id = l_user_status_id,
2767 status_date = sysdate
2768 where import_list_header_id = p_import_list_header_id;
2769 return;
2770 end if;
2771
2772 org_address1_exist_checking(x_import_list_header_id,
2773 x_return_status,x_msg_count,x_msg_data);
2774 if x_return_status <> 'S' then
2775 AMS_Utility_PVT.Create_Log (
2776 x_return_status => l_return_status,
2777 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2778 p_log_used_by_id => p_import_list_header_id,
2779 p_msg_data => 'Aborting org_address1_exist_checking.',
2780 p_msg_type => 'DEBUG');
2781 l_lookup_code := 'ERROR';
2782 l_user_status_id := null;
2783 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2784 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2785 system_status_code = 'ERROR' and default_flag = 'Y';
2786 UPDATE ams_imp_list_headers_all
2787 set status_code = l_lookup_code,
2788 user_status_id = l_user_status_id,
2789 status_date = sysdate
2790 where import_list_header_id = p_import_list_header_id;
2791 return;
2792 end if;
2793
2794 ELSE
2795
2796 if l_osr_mapped = 'Y' then
2797 per_existence_checking_osr(x_import_list_header_id,
2798 x_return_status,x_msg_count,x_msg_data);
2799 end if;
2800 per_existence_checking(x_import_list_header_id,
2801 x_return_status,x_msg_count,x_msg_data);
2802 if x_return_status <> 'S' then
2803 AMS_Utility_PVT.Create_Log (
2804 x_return_status => l_return_status,
2805 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2806 p_log_used_by_id => p_import_list_header_id,
2807 p_msg_data => 'Aborting per_existence_checking.',
2808 p_msg_type => 'DEBUG'); l_lookup_code := 'ERROR';
2809 l_user_status_id := null;
2810 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2811 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2812 system_status_code = 'ERROR' and default_flag = 'Y';
2813
2814 UPDATE ams_imp_list_headers_all
2815 set status_code = l_lookup_code,
2816 user_status_id = l_user_status_id,
2817 status_date = sysdate
2818 where import_list_header_id = p_import_list_header_id;
2819 return;
2820 end if;
2821
2822 per_address_existence_checking(x_import_list_header_id,
2823 x_return_status,x_msg_count,x_msg_data);
2824 if x_return_status <> 'S' then
2825 AMS_Utility_PVT.Create_Log (
2826 x_return_status => l_return_status,
2827 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2828 p_log_used_by_id => p_import_list_header_id,
2829 p_msg_data => 'Aborting per_address_existence_checking.',
2830 p_msg_type => 'DEBUG');
2831 l_lookup_code := 'ERROR';
2832 l_user_status_id := null;
2833 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
2834 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
2835 system_status_code = 'ERROR' and default_flag = 'Y';
2836
2837 UPDATE ams_imp_list_headers_all
2838 set status_code = l_lookup_code,
2839 user_status_id = l_user_status_id,
2840 status_date = sysdate
2841 where import_list_header_id = p_import_list_header_id;
2842 return;
2843 end if;
2844 end if; -- l_imp_type
2845 end if; -- if x_hz_dup_check = 'Y' then
2846 -- >>>>>>>>>>>>>
2847
2848 if l_dedupe_flag = 'Y' then
2849 AMS_Utility_PVT.Create_Log (
2850 x_return_status => l_return_status,
2851 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2852 p_log_used_by_id => p_import_list_header_id,
2853 p_msg_data => 'Starting De-Duplicate check in the Marketing tables .',
2854 p_msg_type => 'DEBUG'
2855 );
2856
2857 dedup_check( p_import_list_header_id);
2858
2859 open c_dup_recs;
2860 fetch c_dup_recs into l_duplicate_records;
2861 close c_dup_recs;
2862 update ams_imp_list_headers_all
2863 set number_of_duplicate_records = l_duplicate_records
2864 where import_list_header_id = p_import_list_header_id;
2865
2866 AMS_Utility_PVT.Create_Log (
2867 x_return_status => l_return_status,
2868 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2869 p_log_used_by_id => p_import_list_header_id,
2870 p_msg_data => 'END De-Duplicate check in the Marketing tables .',
2871 p_msg_type => 'DEBUG'
2872 );
2873 end if;
2874
2875 if p_staged_only = 'N' then
2876 if l_st_code = 'STAGED' then
2877 AMS_Utility_PVT.Create_Log (
2878 x_return_status => l_return_status,
2879 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2880 p_log_used_by_id => p_import_list_header_id,
2881 p_msg_data => 'Starting TCA/LEAD/EVENT program to load the data.',
2882 p_msg_type => 'DEBUG'
2883 );
2884 open c_total_records;
2885 fetch c_total_records into l_total_records;
2886 close c_total_records;
2887 AMS_Utility_PVT.Create_Log (
2888 x_return_status => l_return_status,
2889 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2890 p_log_used_by_id => p_import_list_header_id,
2891 p_msg_data => 'Total Number of records available for processing: '||to_char(l_total_records),
2892 p_msg_type => 'DEBUG'
2893 );
2894 execute_reltnship_validation( p_import_list_header_id, l_return_status);
2895 l_total_records := 0;
2896 open c_total_records;
2897 fetch c_total_records into l_total_records;
2898 close c_total_records;
2899 if l_total_records = 0 then
2900 update_cust_import_status(p_import_list_header_id);
2901 return;
2902 end if;
2903
2904 list_loader ( p_import_list_header_id ,
2905 l_post_request_id
2906 );
2907 l_total_records := 0;
2908 open c_total_records;
2909 fetch c_total_records into l_total_records;
2910 close c_total_records;
2911 AMS_Utility_PVT.Create_Log (
2912 x_return_status => l_return_status,
2913 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2914 p_log_used_by_id => p_import_list_header_id,
2915 p_msg_data => 'Total Number of records not processed: '||to_char(l_total_records),
2916 p_msg_type => 'DEBUG'
2917 );
2918
2919
2920 --aanjaria: bug 3888657
2921 -- commenting out follwoing code as list gen was already called by AMSILHZC conc prog
2922 -- spawned from within list_loader API. This was generating a duplicate list.
2923 /*
2924 if p_generate_list = 'Y' then
2925 AMS_Utility_PVT.Create_Log (
2926 x_return_status => l_return_status,
2927 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2928 p_log_used_by_id => p_import_list_header_id,
2929 p_msg_data => 'Starting List Generation for List Import.',
2930 p_msg_type => 'DEBUG'
2931 );
2932 l_load_rows := 0;
2933 select LOADED_NO_OF_ROWS into l_load_rows from ams_imp_list_headers_all
2934 where import_list_header_id = p_import_list_header_id;
2935
2936 if l_load_rows > 0 then
2937
2938
2939 AMS_ListGeneration_PKG.create_import_list
2940 ( 1,
2941 'T',
2942 'T',
2943 FND_API.G_VALID_LEVEL_FULL,
2944 p_owner_user_id,
2945 p_import_list_header_id,
2946 i_return_status,
2947 i_msg_count,
2948 i_msg_data,
2949 l_list_header_id,
2950 p_list_name) ;
2951
2952 If i_return_status <> 'S' then
2953 AMS_Utility_PVT.Create_Log (
2954 x_return_status => l_return_status,
2955 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2956 p_log_used_by_id => p_import_list_header_id,
2957 p_msg_data => 'Error in List Generation --'||i_msg_data,
2958 p_msg_type => 'DEBUG'
2959 );
2960 End if;
2961 end if;
2962 AMS_Utility_PVT.Create_Log (
2963 x_return_status => l_return_status,
2964 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2965 p_log_used_by_id => p_import_list_header_id,
2966 p_msg_data => 'End List Generation for List Import.',
2967 p_msg_type => 'DEBUG'
2968 );
2969 end if; */
2970 end if;
2971 end if;
2972
2973
2974 -- Import completed successfully
2975 FND_MESSAGE.set_name ('AMS', 'AMS_IMP_LOAD_COMPLETE');
2976 FND_MESSAGE.set_token ('REQUEST_ID', l_request_id);
2977
2978 AMS_Utility_PVT.Create_Log (
2979 x_return_status => l_return_status,
2980 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2981 p_log_used_by_id => p_import_list_header_id,
2982 p_msg_data => FND_MESSAGE.get,
2983 p_msg_type => 'DEBUG'
2984 );
2985
2986 errbuf := SUBSTR (FND_MESSAGE.GET, 1, 240);
2987 retcode := 0; -- no problems.
2988
2989 EXCEPTION
2990 WHEN OTHERS THEN
2991 AMS_Utility_PVT.Create_Log (
2992 x_return_status => l_return_status,
2993 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
2994 p_log_used_by_id => p_import_list_header_id,
2995 p_msg_data => sqlerrm ,
2996 p_msg_type => 'DEBUG'
2997 );
2998 FND_MESSAGE.set_name ('AMS', 'AMS_IMP_LOAD_FAILED');
2999 FND_MESSAGE.set_token ('REQUEST_ID', l_request_id);
3000 l_msg_buf := FND_MESSAGE.get;
3001
3002 AMS_Utility_PVT.Create_Log (
3003 x_return_status => l_return_status,
3004 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3005 p_log_used_by_id => p_import_list_header_id,
3006 p_msg_data => l_msg_buf,
3007 p_msg_type => 'DEBUG'
3008 );
3009 errbuf := SUBSTR (l_msg_buf, 1, 240);
3010 retcode := 2;
3011
3012 END load_to_ams;
3013
3014 -- ------------------------------------------------------
3015 -- This program calls concurrent programs for TCA , Leads
3016 -- etc to populate the data.
3017 --
3018
3019 PROCEDURE list_loader (
3020 p_import_list_header_id NUMBER,
3021 x_request_id OUT NOCOPY NUMBER
3022 ) IS
3023
3024 l_request_id NUMBER;
3025 l_return_status VARCHAR2(1);
3026 l_import_type VARCHAR2(30);
3027 l_conc_prog_name VARCHAR2(60);
3028 l_lookup_code VARCHAR2(30);
3029 l_user_status_id NUMBER;
3030
3031 l_phase VARCHAR2(30);
3032 l_appli VARCHAR2(30);
3033 l_prog VARCHAR2(30);
3034 l_status VARCHAR2(30);
3035 l_dev_phase VARCHAR2(30);
3036 l_dev_status VARCHAR2(30);
3037 l_message VARCHAR2(240);
3038 l_rstatus BOOLEAN;
3039 l_wait_status BOOLEAN;
3040 l_batch_id NUMBER;
3041 l_validate_file VARCHAR2(1);
3042 l_error_exist VARCHAR2(1);
3043 l_loaded_records NUMBER;
3044 l_failed_records NUMBER;
3045
3046 i_msg_buf VARCHAR2(4000);
3047 i_msg_code NUMBER;
3048 l_mesg_text VARCHAR2(2000);
3049 l_numb_of_inst number;
3050
3051
3052 cursor c_import_type is
3053 select import_type,VALIDATE_FILE,NUMBER_OF_INSTANCES from ams_imp_list_headers_all
3054 where import_list_header_id = p_import_list_header_id;
3055
3056 cursor c_conc_name is
3057 SELECT concurrent_program FROM ams_imp_list_import_types
3058 where import_type = l_import_type;
3059
3060 cursor c_error_exist is
3061 select 'Y' from ams_list_import_errors
3062 where import_list_header_id = p_import_list_header_id
3063 and error_type = 'E'
3064 and rownum < 2;
3065
3066 cursor c_loaded_records is
3067 select count(*) from ams_imp_source_lines
3068 where import_list_header_id = p_import_list_header_id
3069 and load_status = G_STATUS_SUCCESS;
3070
3071 cursor c_failed_records is
3072 select count(*) from ams_imp_source_lines
3073 where import_list_header_id = p_import_list_header_id
3074 and load_status = G_STATUS_ERROR;
3075
3076
3077
3078 begin
3079
3080 open c_import_type;
3081 fetch c_import_type into l_import_type,l_validate_file,l_numb_of_inst;
3082 close c_import_type;
3083 open c_conc_name;
3084 fetch c_conc_name into l_conc_prog_name;
3085 close c_conc_name;
3086
3087 l_lookup_code := 'SCHEDULED';
3088 l_user_status_id := null;
3089 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3090 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3091 system_status_code = 'SCHEDULED' and default_flag = 'Y';
3092
3093
3094 UPDATE ams_imp_list_headers_all
3095 set status_code = l_lookup_code,
3096 user_status_id = l_user_status_id,
3097 status_date = sysdate
3098 where import_list_header_id = p_import_list_header_id;
3099
3100 -- if l_import_type = 'CUSTOMER' then
3101 if (l_import_type = 'B2B' or l_import_type = 'B2C') then
3102 -- Call the Validate Process
3103 if l_validate_file = 'Y' then
3104 AMS_Utility_PVT.Create_Log (
3105 x_return_status => l_return_status,
3106 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3107 p_log_used_by_id => p_import_list_header_id,
3108 p_msg_data => 'Starting Validation for Customer data.',
3109 p_msg_type => 'DEBUG'
3110 );
3111
3112 -- Delete all the errors from the errors table which are reloaded.
3113 delete from ams_list_import_errors where import_list_header_id
3114 = p_import_list_header_id and import_source_line_id = 0;
3115 delete from ams_list_import_errors where import_list_header_id
3116 = p_import_list_header_id and import_source_line_id in
3117 (select import_source_line_id from ams_imp_source_lines where
3118 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_RELOAD);
3119 /*
3120 if l_file_type = 'XML' then
3121 update_xml_error_text (
3122 p_import_list_header_id,
3123 l_import_type);
3124 end if;
3125 */
3126 l_return_status := null;
3127 execute_cust_data_validation ( p_import_list_header_id, l_return_status);
3128 if l_return_status <> 'S' then
3129 AMS_Utility_PVT.Create_Log (
3130 x_return_status => l_return_status,
3131 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3132 p_log_used_by_id => p_import_list_header_id,
3133 p_msg_data => 'Customer import terminated because of error in Data validation process.',
3134 p_msg_type => 'DEBUG'
3135 );
3136
3137 l_lookup_code := 'ERROR';
3138 l_user_status_id := null;
3139 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3140 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3141 system_status_code = 'ERROR' and default_flag = 'Y';
3142
3143 UPDATE ams_imp_list_headers_all
3144 set status_code = l_lookup_code,
3145 user_status_id = l_user_status_id,
3146 status_date = sysdate
3147 where import_list_header_id = p_import_list_header_id;
3148 return;
3149 end if;
3150
3151 AMS_Utility_PVT.Create_Log (
3152 x_return_status => l_return_status,
3153 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3154 p_log_used_by_id => p_import_list_header_id,
3155 p_msg_data => 'End Validation for Customer data.',
3156 p_msg_type => 'DEBUG'
3157 );
3158 end if;
3159
3160 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
3161 application => 'AMS',
3162 program => l_conc_prog_name, -- 'AMSILHZC',
3163 argument1 => p_import_list_header_id,
3164 argument2 => l_numb_of_inst
3165 );
3166
3167 AMS_Utility_PVT.Create_Log (
3168 x_return_status => l_return_status,
3169 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3170 p_log_used_by_id => p_import_list_header_id,
3171 p_msg_data => 'Starting TCA program (AMSILHZC) -- concurrent program_id is '||to_char(l_request_id),
3172 p_msg_type => 'DEBUG'
3173 );
3174
3175 end if;
3176
3177 IF l_request_id = 0 THEN
3178 l_mesg_text := fnd_message.get;
3179 AMS_Utility_PVT.Create_Log (
3180 x_return_status => l_return_status,
3181 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3182 p_log_used_by_id => p_import_list_header_id,
3183 p_msg_data => l_mesg_text,
3184 p_msg_type => 'DEBUG' );
3185
3186 l_user_status_id := null;
3187 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3188 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3189 system_status_code = 'ERROR' and default_flag = 'Y';
3190 UPDATE ams_imp_list_headers_all
3191 set status_code = l_lookup_code,
3192 user_status_id = l_user_status_id,
3193 status_date = sysdate
3194 where import_list_header_id = p_import_list_header_id;
3195 commit;
3196 RAISE FND_API.g_exc_unexpected_error;
3197 end if;
3198
3199 if l_import_type = 'LEAD' then
3200 /*
3201 SELECT batch_id into l_batch_id FROM as_import_interface
3202 WHERE IMP_LIST_HEADER_NUMBER = p_import_list_header_id AND ROWNUM < 2;
3203 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
3204 application => 'AS', -- 'AST',
3205 program => l_conc_prog_name, -- ' ASXSLIMP' 'AST_LEAD_IMPORT',
3206 argument1 => 'NEW', -- 'ORACLE.COM',
3207 argument2 => NULL,
3208 argument3 => l_batch_id, -- NULL,
3209 argument4 => 'N'
3210 );
3211 */
3212 execute_lead_import ( p_import_list_header_id);
3213 /*
3214 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
3215 application => 'AMS',
3216 program => 'AMSILLDC',
3217 argument1 => p_import_list_header_id
3218 );
3219 AMS_Utility_PVT.Create_Log (
3220 x_return_status => l_return_status,
3221 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3222 p_log_used_by_id => p_import_list_header_id,
3223 p_msg_data => 'Starting LEAD program (ASXSLIMP) -- concurrent program_id is '||to_char(l_request_id),
3224 p_msg_type => 'DEBUG'
3225 );
3226 */
3227 end if;
3228 /*
3229 IF l_request_id = 0 THEN
3230 RAISE FND_API.g_exc_unexpected_error;
3231 end if;
3232 */
3233 if l_import_type = 'EVENT' then
3234 -- Call the Validate Process
3235 if l_validate_file = 'Y' then
3236 AMS_Utility_PVT.Create_Log (
3237 x_return_status => l_return_status,
3238 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3239 p_log_used_by_id => p_import_list_header_id,
3240 p_msg_data => 'Starting Validation for Event data.',
3241 p_msg_type => 'DEBUG'
3242 );
3243
3244 -- Delete all the errors from the errors table which are reloaded.
3245 delete from ams_list_import_errors where import_list_header_id
3246 = p_import_list_header_id and import_source_line_id = 0;
3247 delete from ams_list_import_errors where import_list_header_id
3248 = p_import_list_header_id and import_source_line_id in
3249 (select import_source_line_id from ams_imp_source_lines where
3250 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_RELOAD);
3251
3252 l_return_status := null;
3253 execute_event_data_validation ( p_import_list_header_id, l_return_status);
3254 if l_return_status <> 'S' then
3255 AMS_Utility_PVT.Create_Log (
3256 x_return_status => l_return_status,
3257 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3258 p_log_used_by_id => p_import_list_header_id,
3259 p_msg_data => 'Event import terminated because of error in Data validation process.',
3260 p_msg_type => 'DEBUG'
3261 );
3262
3263 l_lookup_code := 'ERROR';
3264 l_user_status_id := null;
3265 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3266 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3267 system_status_code = 'ERROR' and default_flag = 'Y';
3268
3269 UPDATE ams_imp_list_headers_all
3270 set status_code = l_lookup_code,
3271 user_status_id = l_user_status_id,
3272 status_date = sysdate
3273 where import_list_header_id = p_import_list_header_id;
3274 return;
3275 end if;
3276
3277 AMS_Utility_PVT.Create_Log (
3278 x_return_status => l_return_status,
3279 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3280 p_log_used_by_id => p_import_list_header_id,
3281 p_msg_data => 'End Validation for Event data.',
3282 p_msg_type => 'DEBUG'
3283 );
3284 end if;
3285
3286 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
3287 application => 'AMS', -- 'AST',
3288 program => l_conc_prog_name, -- ' AMSERIMP',
3289 argument1 => p_import_list_header_id
3290 );
3291
3292 AMS_Utility_PVT.Create_Log (
3293 x_return_status => l_return_status,
3294 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3295 p_log_used_by_id => p_import_list_header_id,
3296 p_msg_data => 'Starting EVENT program (AMSERIMP) -- concurrent program_id is '||to_char(l_request_id),
3297 p_msg_type => 'DEBUG'
3298 );
3299
3300 end if;
3301 commit;
3302 -- The sql*loader concurrent program MUST finish
3303 -- before updating the status_code
3304
3305 l_wait_status := FND_CONCURRENT.WAIT_FOR_REQUEST (
3306 request_id => l_request_id,
3307 phase => l_phase,
3308 status => l_status,
3309 dev_phase => l_dev_phase,
3310 dev_status => l_dev_status,
3311 message => l_message
3312 );
3313
3314 ---------------------------------------------
3315 -- WAIT_STATUS should only come back as
3316 -- TRUE. It only comes back as FALSE if
3317 -- the conc request was not successfully
3318 -- submitted.
3319 ---------------------------------------------
3320 IF NOT l_wait_status THEN
3321 l_mesg_text := fnd_message.get;
3322 AMS_Utility_PVT.Create_Log (
3323 x_return_status => l_return_status,
3324 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3325 p_log_used_by_id => p_import_list_header_id,
3326 p_msg_data => l_mesg_text,
3327 p_msg_type => 'DEBUG' );
3328
3329 l_user_status_id := null;
3330 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3331 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3332 system_status_code = 'ERROR' and default_flag = 'Y';
3333 UPDATE ams_imp_list_headers_all
3334 set status_code = l_lookup_code,
3335 user_status_id = l_user_status_id,
3336 status_date = sysdate
3337 where import_list_header_id = p_import_list_header_id;
3338 commit;
3339 RAISE FND_API.g_exc_unexpected_error;
3340 END IF;
3341 /*
3342 if l_import_type = 'LEAD' then
3343 capture_lead_error(p_import_list_header_id);
3344 end if;
3345 */
3346 l_rstatus := FND_CONCURRENT.get_REQUEST_status (
3347 request_id => l_request_id,
3348 APPL_SHORTNAME => l_appli,
3349 program => l_prog,
3350 phase => l_phase,
3351 status => l_status,
3352 dev_phase => l_dev_phase,
3353 dev_status => l_dev_status,
3354 message => l_message
3355 );
3356
3357 if l_dev_phase = 'COMPLETE' then
3358 if l_dev_status = 'NORMAL' then
3359 l_lookup_code := 'COMPLETED';
3360 l_user_status_id := null;
3361 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3362 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3363 system_status_code = 'COMPLETED' and default_flag = 'Y';
3364 end if;
3365 if l_dev_status = 'ERROR' then
3366 l_lookup_code := 'ERROR';
3367 l_user_status_id := null;
3368 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3369 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3370 system_status_code = 'ERROR' and default_flag = 'Y';
3371 end if;
3372
3373 UPDATE ams_imp_list_headers_all
3374 set status_code = l_lookup_code,
3375 user_status_id = l_user_status_id,
3376 status_date = sysdate
3377 where import_list_header_id = p_import_list_header_id;
3378 end if;
3379
3380 -- Delete all the errors from the errors table which are sucessful.
3381 delete from ams_list_import_errors where import_list_header_id
3382 = p_import_list_header_id and import_source_line_id in
3383 (select import_source_line_id from ams_imp_source_lines where
3384 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_SUCCESS);
3385
3386 open c_loaded_records;
3387 fetch c_loaded_records into l_loaded_records;
3388 close c_loaded_records;
3389 open c_failed_records;
3390 fetch c_failed_records into l_failed_records;
3391 close c_failed_records;
3392 UPDATE ams_imp_list_headers_all
3393 SET loaded_no_of_rows = l_loaded_records,
3394 number_of_failed_records = l_failed_records,
3395 loaded_date = sysdate
3396 WHERE import_list_header_id = p_import_list_header_id;
3397
3398
3399 COMMIT;
3400 x_request_id := l_request_id;
3401 open c_error_exist;
3402 fetch c_error_exist into l_error_exist;
3403 close c_error_exist;
3404 if l_error_exist = 'Y' then
3405 l_lookup_code := 'ERROR';
3406 l_user_status_id := null;
3407 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3408 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3409 system_status_code = 'ERROR' and default_flag = 'Y';
3410
3411 UPDATE ams_imp_list_headers_all
3412 set status_code = l_lookup_code,
3413 user_status_id = l_user_status_id,
3414 status_date = sysdate
3415 where import_list_header_id = p_import_list_header_id;
3416 end if;
3417
3418 EXCEPTION
3419 WHEN others THEN
3420 AMS_Utility_PVT.Create_Log (
3421 x_return_status => l_return_status,
3422 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3423 p_log_used_by_id => p_import_list_header_id,
3424 p_msg_data => sqlerrm ,
3425 p_msg_type => 'DEBUG'
3426 );
3427 raise;
3428
3429 end list_loader;
3430
3431 -- --------------------------------------------
3432 --
3433 -- This is the main program which calls all the concurrent programs
3434 -- to populate the data in OMO and then other destination application
3435 -- like TCA or Oracle sales etc.
3436 --
3437 PROCEDURE Import_process (
3438 p_import_list_header_id IN NUMBER,
3439 p_start_time IN DATE,
3440 p_control_file IN VARCHAR2, -- Name of file to be used by the SQL*Loader process.
3441 p_staged_only IN VARCHAR2 , -- Used for staged table import.
3442 p_owner_user_id IN NUMBER, -- Used for list generation (resource_id)
3443 p_generate_list IN VARCHAR2 ,
3444 p_list_name IN VARCHAR2, -- For list generation name.
3445 x_request_id OUT NOCOPY NUMBER -- Used for concurrent program monitoring (for sql*loader).
3446 ) IS
3447
3448 l_request_id NUMBER;
3449 l_message VARCHAR2(240);
3450 l_return_status VARCHAR2(1);
3451 l_ret_status VARCHAR2(1);
3452 l_msg_count NUMBER;
3453 l_msg_data VARCHAR2(2000);
3454 l_msg_buf VARCHAR2(4000);
3455 l_file_type VARCHAR2(30);
3456 L_LOOKUP_CODE VARCHAR2(30);
3457 L_USER_STATUS_ID NUMBER;
3458 x_imp_type VARCHAR2(240);
3459 L_MESG_TEXT VARCHAR2(2000);
3460
3461
3462 cursor c_file_type is
3463 select file_type from ams_imp_documents where import_list_header_id = p_import_list_header_id;
3464
3465 cursor c_imptype is
3466 select import_type from ams_imp_list_headers_all where import_list_header_id = p_import_list_header_id;
3467
3468
3469 begin
3470
3471 AMS_Utility_PVT.Create_Log (
3472 x_return_status => l_ret_status,
3473 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3474 p_log_used_by_id => p_import_list_header_id,
3475 p_msg_data => 'Starting List Import Process',
3476 p_msg_type => 'DEBUG'
3477 );
3478 update ams_imp_list_headers_all
3479 set GENERATE_LIST = decode(p_generate_list,'Y','Y','DUMMY','N','N'),
3480 GENERATED_LIST_NAME = p_list_name
3481 where import_list_header_id = p_import_list_header_id;
3482 commit;
3483
3484 open c_file_type;
3485 fetch c_file_type into l_file_type;
3486 close c_file_type;
3487 if l_file_type is NULL then
3488 AMS_Utility_PVT.Create_Log (
3489 x_return_status => l_return_status,
3490 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3491 p_log_used_by_id => p_import_list_header_id,
3492 p_msg_data => 'Aborting import process, File type missing.',
3493 p_msg_type => 'DEBUG'
3494 );
3495 l_lookup_code := 'ERROR';
3496 l_user_status_id := null;
3497 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3498 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3499 system_status_code = 'ERROR' and default_flag = 'Y';
3500
3501 UPDATE ams_imp_list_headers_all
3502 set status_code = l_lookup_code,
3503 user_status_id = l_user_status_id,
3504 status_date = sysdate
3505 where import_list_header_id = p_import_list_header_id;
3506 return;
3507 end if;
3508
3509 open c_imptype;
3510 fetch c_imptype into x_imp_type;
3511 close c_imptype;
3512 if (l_file_type = 'XML' and x_imp_type in ('LEAD','EVENT')) then
3513 AMS_Utility_PVT.Create_Log (
3514 x_return_status => l_return_status,
3515 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3516 p_log_used_by_id => p_import_list_header_id,
3517 p_msg_data => 'XML import is not available for EVENT and LEADS, Aborting import process',
3518 p_msg_type => 'DEBUG'
3519 );
3520 l_user_status_id := null;
3521 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3522 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3523 system_status_code = 'ERROR' and default_flag = 'Y';
3524
3525 UPDATE ams_imp_list_headers_all
3526 set status_code = 'ERROR',
3527 user_status_id = l_user_status_id,
3528 status_date = sysdate
3529 where import_list_header_id = p_import_list_header_id;
3530 return;
3531 end if;
3532
3533 if l_file_type = 'CSV' then
3534 --
3535 -- SQL*LOADER call to populate the data in OMO tables.
3536 --
3537 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
3538 application => 'AMS',
3539 program => 'AMSILOMC',
3540 argument1 => p_import_list_header_id,
3541 argument2 => p_control_file,
3542 argument3 => p_staged_only,
3543 argument4 => p_owner_user_id,
3544 argument5 => p_generate_list,
3545 argument6 => p_list_name
3546 );
3547 IF l_request_id = 0 THEN
3548 l_mesg_text := fnd_message.get;
3549 AMS_Utility_PVT.Create_Log (
3550 x_return_status => l_return_status,
3551 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3552 p_log_used_by_id => p_import_list_header_id,
3553 p_msg_data => l_mesg_text,
3554 p_msg_type => 'DEBUG' );
3555
3556 l_user_status_id := null;
3557 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3558 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3559 system_status_code = 'ERROR' and default_flag = 'Y';
3560 UPDATE ams_imp_list_headers_all
3561 set status_code = l_lookup_code,
3562 user_status_id = l_user_status_id,
3563 status_date = sysdate
3564 where import_list_header_id = p_import_list_header_id;
3565 commit;
3566
3567 RAISE FND_API.g_exc_unexpected_error;
3568 end if;
3569 AMS_Utility_PVT.Create_Log (
3570 x_return_status => l_ret_status,
3571 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3572 p_log_used_by_id => p_import_list_header_id,
3573 p_msg_data => 'List Import Concurrent Program AMSILOMC Started.',
3574 p_msg_type => 'DEBUG'
3575 );
3576 x_request_id := l_request_id;
3577 end if;
3578 if l_file_type = 'XML' then
3579 client_load_direct (
3580 p_import_list_header_id,
3581 p_owner_user_id,
3582 p_generate_list,
3583 p_list_name);
3584 end if;
3585
3586 EXCEPTION
3587 WHEN others THEN
3588 raise;
3589
3590 end Import_process;
3591
3592
3593 -- ------------------------------------------
3594
3595 PROCEDURE client_load(
3596 p_import_list_header_id IN NUMBER,
3597 p_owner_user_id IN NUMBER,
3598 p_generate_list IN VARCHAR2 ,
3599 p_list_name IN VARCHAR2 -- For list generation name.
3600 ) IS
3601
3602 x_prof_file_size VARCHAR2(100);
3603 x_file_type VARCHAR2(100);
3604 x_imp_type VARCHAR2(100);
3605 x_client_file_size NUMBER;
3606 l_return_status VARCHAR2(1);
3607 l_request_id NUMBER;
3608 l_user_status_id number;
3609 L_MESG_TEXT varchar2(2000);
3610 L_LOOKUP_CODE varchar2(30);
3611
3612 cursor c_prof_file_size is
3613 select file_size, file_type from AMS_IMP_DOCUMENTS where import_list_header_id = p_import_list_header_id;
3614
3615 cursor c_imptype is
3616 select import_type from ams_imp_list_headers_all where import_list_header_id = p_import_list_header_id;
3617
3618 BEGIN
3619 -- x_prof_file_size := fnd_profile.value('AMS_IMP_CLIENT_FILE_SIZE');
3620 open c_prof_file_size;
3621 fetch c_prof_file_size into x_client_file_size,x_file_type;
3622 close c_prof_file_size;
3623 open c_imptype;
3624 fetch c_imptype into x_imp_type;
3625 close c_imptype;
3626 update ams_imp_list_headers_all
3627 set GENERATE_LIST = decode(p_generate_list,'Y','Y','DUMMY','N','N'),
3628 GENERATED_LIST_NAME = p_list_name
3629 where import_list_header_id = p_import_list_header_id;
3630 commit;
3631
3632 if (x_file_type = 'XML' and x_imp_type in ('LEAD','EVENT')) then
3633 AMS_Utility_PVT.Create_Log (
3634 x_return_status => l_return_status,
3635 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3636 p_log_used_by_id => p_import_list_header_id,
3637 p_msg_data => 'XML import is not available for EVENT and LEADS, Aborting import process',
3638 p_msg_type => 'DEBUG'
3639 );
3640 l_user_status_id := null;
3641 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3642 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3643 system_status_code = 'ERROR' and default_flag = 'Y';
3644
3645 UPDATE ams_imp_list_headers_all
3646 set status_code = 'ERROR',
3647 user_status_id = l_user_status_id,
3648 status_date = sysdate
3649 where import_list_header_id = p_import_list_header_id;
3650 return;
3651 end if;
3652 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
3653 application => 'AMS',
3654 program => 'AMSIMCCM',
3655 argument1 => p_import_list_header_id,
3656 argument2 => p_owner_user_id,
3657 argument3 => p_generate_list,
3658 argument4 => p_list_name
3659 );
3660 AMS_Utility_PVT.Create_Log (
3661 x_return_status => l_return_status,
3662 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3663 p_log_used_by_id => p_import_list_header_id,
3664 p_msg_data => 'Starting client side import program (AMSIMCCM) -- concurrent program_id is '||to_char(l_request_id),
3665 p_msg_type => 'DEBUG');
3666 commit;
3667 IF l_request_id = 0 THEN
3668 l_mesg_text := fnd_message.get;
3669 AMS_Utility_PVT.Create_Log (
3670 x_return_status => l_return_status,
3671 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3672 p_log_used_by_id => p_import_list_header_id,
3673 p_msg_data => l_mesg_text,
3674 p_msg_type => 'DEBUG' );
3675
3676 l_user_status_id := null;
3677 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
3678 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
3679 system_status_code = 'ERROR' and default_flag = 'Y';
3680 UPDATE ams_imp_list_headers_all
3681 set status_code = l_lookup_code,
3682 user_status_id = l_user_status_id,
3683 status_date = sysdate
3684 where import_list_header_id = p_import_list_header_id;
3685 commit;
3686 RAISE FND_API.g_exc_unexpected_error;
3687 end if;
3688
3689 EXCEPTION
3690 WHEN others THEN
3691 AMS_Utility_PVT.Create_Log (
3692 x_return_status => l_return_status,
3693 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3694 p_log_used_by_id => p_import_list_header_id,
3695 p_msg_data => sqlerrm ,
3696 p_msg_type => 'DEBUG'
3697 );
3698 raise;
3699 end client_load;
3700
3701
3702 -- -------------------------------------------
3703 --
3704 -- This progam checkes the de-duplication rules
3705
3706 PROCEDURE dedup_check(
3707 p_import_list_header_id NUMBER
3708 ) IS
3709
3710 i_rule_id NUMBER;
3711 i NUMBER := 0;
3712 i_col_string VARCHAR2(2000);
3713 i_string VARCHAR2(4000);
3714 i_str VARCHAR2(4000);
3715 i_str1 VARCHAR2(4000);
3716 i_str2 VARCHAR2(4000);
3717 i_column VARCHAR2(60);
3718 i_table_name VARCHAR2(60);
3719 l_return_status VARCHAR2(1);
3720 l_word_replace VARCHAR2(1);
3721 l_b2b_flag VARCHAR2(1);
3722 i_org_value VARCHAR2(60);
3723 i_rep_value VARCHAR2(60);
3724 i_replace_value VARCHAR2(60);
3725 i_imp_src_line_id NUMBER;
3726 i_word_rep_type VARCHAR2(60);
3727 i_file_type VARCHAR2(60);
3728 i_xml_element_id NUMBER;
3729 l_rule_type VARCHAR2(30);
3730
3731
3732 /* mayjain bug 5235979 */
3733 cursor c_rule_type is
3734 SELECT 'IMPORT_CUST_' || import_type
3735 FROM ams_imp_list_headers_all
3736 where import_list_header_id = p_import_list_header_id;
3737
3738 cursor c_ruleid (p_rule_type VARCHAR2) is
3739 SELECT us.list_rule_id
3740 FROM ams_list_rule_usages us, ams_list_rules_all rules
3741 WHERE us.list_header_id = p_import_list_header_id
3742 AND us.list_rule_id = rules.list_rule_id
3743 AND rules.list_rule_type = p_rule_type;
3744 /* mayjain bug 5235979 */
3745
3746 cursor c_rule_field is
3747 SELECT field_column_name, WORD_REPLACEMENT_CODE
3748 FROM ams_list_rule_fields
3749 WHERE list_rule_id = i_rule_id;
3750
3751 cursor c_table_name is
3752 SELECT field_table_name FROM ams_list_rule_fields
3753 WHERE list_rule_id = i_rule_id;
3754
3755 cursor c_word is
3756 select nvl(ENABLE_WORD_REPLACEMENT_FLAG,'N'), nvl(b2b_flag,'N') from
3757 ams_imp_list_headers_all
3758 WHERE import_list_header_id = p_import_list_header_id;
3759
3760 cursor c_imp_src is
3761 select import_source_line_id from ams_imp_source_lines
3762 WHERE import_list_header_id = p_import_list_header_id
3763 AND load_status <> 'DUPLICATE';
3764
3765 cursor c_file_type is
3766 select file_type from ams_imp_documents
3767 where import_list_header_id = p_import_list_header_id;
3768
3769 cursor c_dup_recs is
3770 select COL68 from ams_imp_source_lines
3771 where load_status = 'DUPLICATE'
3772 AND import_list_header_id = p_import_list_header_id;
3773
3774
3775 begin
3776 /* mayjain bug 5235979 */
3777 open c_rule_type ;
3778 fetch c_rule_type into l_rule_type;
3779 close c_rule_type;
3780
3781 AMS_Utility_PVT.Create_Log (
3782 x_return_status => l_return_status,
3783 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3784 p_log_used_by_id => p_import_list_header_id,
3785 p_msg_data => 'Dedupe Check Rule Type '||l_rule_type,
3786 p_msg_type => 'DEBUG');
3787 commit;
3788
3789 open c_ruleid (l_rule_type);
3790 fetch c_ruleid into i_rule_id;
3791 close c_ruleid;
3792
3793 AMS_Utility_PVT.Create_Log (
3794 x_return_status => l_return_status,
3795 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3796 p_log_used_by_id => p_import_list_header_id,
3797 p_msg_data => 'Dedupe Check Rule Id '||i_rule_id,
3798 p_msg_type => 'DEBUG');
3799 commit;
3800 /* mayjain bug 5235979 */
3801
3802 open c_table_name;
3803 fetch c_table_name into i_table_name;
3804 close c_table_name;
3805
3806 open c_word;
3807 fetch c_word into l_word_replace, l_b2b_flag;
3808 close c_word;
3809
3810 open c_file_type;
3811 fetch c_file_type into i_file_type;
3812 close c_file_type;
3813
3814 i_string := 'update '||i_table_name||' set dedupe_key = ';
3815
3816 if l_word_replace = 'N' then
3817 open c_rule_field;
3818 LOOP
3819 fetch c_rule_field into i_column, i_word_rep_type;
3820 exit when c_rule_field%notfound;
3821 if i = 0 then
3822 i_string := i_string||i_column;
3823 else
3824 i_string := i_string||'||'||'''.'''||'||'||i_column;
3825 end if;
3826 i := 1;
3827 END LOOP;
3828 close c_rule_field;
3829 i_string := i_string||'' ;
3830 i_string := i_string||' where import_list_header_id = :1';
3831
3832 EXECUTE IMMEDIATE i_string USING IN p_import_list_header_id;
3833 end if ; -- l_word_replace = 'N;
3834
3835
3836 if l_word_replace = 'Y' then
3837 open c_imp_src;
3838 LOOP
3839 fetch c_imp_src into i_imp_src_line_id;
3840 exit when c_imp_src%notfound;
3841 i_string := 'update '||i_table_name||' set dedupe_key = ';
3842 i := 0;
3843 open c_rule_field;
3844 LOOP
3845 fetch c_rule_field into i_column, i_word_rep_type;
3846 exit when c_rule_field%notfound;
3847 i_org_value := null;
3848 i_rep_value := null;
3849 i_replace_value := null;
3850 i_str := 'select '||i_column||' from '||i_table_name;
3851 i_str := i_str||' where import_source_line_id = :i_imp_src_line_id ';
3852
3853 EXECUTE IMMEDIATE i_str INTO i_org_value using i_imp_src_line_id;
3854
3855 i_rep_value := AMS_ListDedupe_PVT.Replace_Word(upper(i_org_value),i_word_rep_type);
3856 if i_rep_value is not null then
3857 i_replace_value := '''';
3858 i_replace_value := i_replace_value||i_rep_value;
3859 i_replace_value := i_replace_value||'''';
3860 i_column := i_replace_value;
3861 end if;
3862 if i = 0 then
3863 i_string := i_string||i_column;
3864 else
3865 i_string := i_string||'||'||'''.'''||'||'||i_column;
3866 end if;
3867 i := 1;
3868 END LOOP;
3869 close c_rule_field;
3870 i_string := i_string||'' ;
3871 i_string := i_string||' where import_list_header_id = :p_import_list_header_id ';
3872 i_string := i_string||' and import_source_line_id = :i_imp_src_line_id ';
3873
3874 EXECUTE IMMEDIATE i_string USING p_import_list_header_id, i_imp_src_line_id;
3875 i_string := null;
3876 END LOOP;
3877 close c_imp_src;
3878 end if ; -- l_word_replace = 'y ;
3879
3880
3881 UPDATE ams_imp_source_lines a SET a.duplicate_flag = 'Y' , load_status = 'DUPLICATE'
3882 WHERE a.import_list_header_id = p_import_list_header_id
3883 AND a.ROWID > (SELECT MIN(b.ROWID) FROM ams_imp_source_lines b
3884 WHERE b.import_list_header_id = a.import_list_header_id
3885 AND b.dedupe_key = a.dedupe_key
3886 AND b.import_list_header_id = p_import_list_header_id
3887 );
3888 exception
3889 when others then
3890 AMS_Utility_PVT.Create_Log (
3891 x_return_status => l_return_status,
3892 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3893 p_log_used_by_id => p_import_list_header_id,
3894 p_msg_data => sqlerrm ,
3895 p_msg_type => 'DEBUG'
3896 );
3897 raise;
3898
3899 end dedup_check;
3900
3901 PROCEDURE capture_lead_error(
3902 p_import_list_header_id IN NUMBER
3903 ) IS
3904
3905 i_lead_error VARCHAR2(2000);
3906 l_ret_status varchar(1);
3907
3908 cursor c_error is
3909 SELECT error.error_text
3910 FROM as_lead_import_errors error,
3911 as_import_interface inter
3912 WHERE error.batch_id = inter.batch_id
3913 AND inter.IMP_LIST_HEADER_NUMBER = p_import_list_header_id;
3914
3915 BEGIN
3916
3917 OPEN c_error;
3918 LOOP
3919 FETCH c_error into i_lead_error;
3920 exit when c_error%notfound;
3921 AMS_Utility_PVT.Create_Log (
3922 x_return_status => l_ret_status,
3923 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3924 p_log_used_by_id => p_import_list_header_id,
3925 p_msg_data => 'Lead Error- '||i_lead_error,
3926 p_msg_type => 'DEBUG'
3927 );
3928 END LOOP;
3929 CLOSE c_error;
3930 exception
3931 when others then
3932 AMS_Utility_PVT.Create_Log (
3933 x_return_status => l_ret_status,
3934 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
3935 p_log_used_by_id => p_import_list_header_id,
3936 p_msg_data => sqlerrm ,
3937 p_msg_type => 'DEBUG'
3938 );
3939 raise;
3940 END capture_lead_error;
3941 --
3942
3943 PROCEDURE execute_lead_import (
3944 -- Errbuf OUT NOCOPY VARCHAR2,
3945 -- Retcode OUT NOCOPY VARCHAR2,
3946 p_import_list_header_id NUMBER
3947 ) IS
3948
3949 l_phase VARCHAR2(30);
3950 l_appli VARCHAR2(30);
3951 l_prog VARCHAR2(30);
3952 l_status VARCHAR2(30);
3953 l_dev_phase VARCHAR2(30);
3954 l_dev_status VARCHAR2(30);
3955 l_message VARCHAR2(240);
3956 l_rstatus BOOLEAN;
3957 l_wait_status BOOLEAN;
3958
3959 l_source_system VARCHAR2(100);
3960 l_lead_status VARCHAR2(30);
3961 i_processed_records NUMBER;
3962 i_failed_records NUMBER;
3963 l_request_id NUMBER;
3964 l_conc_prog_name VARCHAR2(60);
3965
3966 l_ret_status varchar(1);
3967
3968 l_import_type VARCHAR2(30);
3969 l_batch_id NUMBER;
3970 l_lookup_code VARCHAR2(30);
3971 l_return_status VARCHAR2(1);
3972 l_user_status_id NUMBER;
3973 l_execute_mode VARCHAR2(1);
3974 l_validate_file VARCHAR2(1);
3975 x_return_status VARCHAR2(1);
3976 l_error_exist VARCHAR2(1);
3977 l_rec_in_ams NUMBER;
3978 l_rec_failed_in_ams NUMBER;
3979 l_rec_in_as NUMBER;
3980 l_rec_succ_in_as NUMBER;
3981 l_rec_fail_in_as NUMBER;
3982 l_loaded_records NUMBER;
3983 l_failed_records NUMBER;
3984 l_rec_dup_in_as NUMBER;
3985 L_MESG_TEXT varchar2(2000);
3986
3987 cursor c_lead_status is
3988 SELECT distinct load_status FROM as_import_interface
3989 WHERE load_status = 'ERROR' AND batch_id = l_batch_id;
3990
3991 cursor c_lead_status_sucess is
3992 SELECT distinct load_status FROM as_import_interface
3993 WHERE load_status = 'SUCCESS' AND batch_id = l_batch_id;
3994
3995 cursor c_event_status is
3996 select nvl(PROCESSED_ROWS,0), nvl(NUMBER_OF_FAILED_RECORDS,0)
3997 from ams_imp_list_headers_all
3998 where import_list_header_id = p_import_list_header_id;
3999
4000 cursor c_conc_name is
4001 SELECT concurrent_program FROM ams_imp_list_import_types
4002 where import_type = 'LEAD';
4003
4004 cursor c_lead_process is
4005 SELECT batch_id, VALIDATE_FILE, EXECUTE_MODE FROM ams_imp_list_headers_all
4006 WHERE import_list_header_id = p_import_list_header_id ;
4007
4008 cursor c_lead_source_system is
4009 select source_system from ams_lead_mapping_v
4010 where import_list_header_id = p_import_list_header_id
4011 and load_status in ('ACTIVE','RELOAD')
4012 and source_system is not NULL
4013 and rownum < 2;
4014
4015 /*
4016 cursor c_error_exist is
4017 select 'Y' from ams_imp_source_lines -- ams_list_import_errors
4018 where import_list_header_id = p_import_list_header_id
4019 and load_status = 'ERROR'
4020 -- and error_type = 'E'
4021 and rownum < 2;
4022 */
4023 cursor c_error_exist is
4024 select 'Y' from ams_list_import_errors
4025 where import_list_header_id = p_import_list_header_id
4026 and error_type = 'E'
4027 and col1 <> 'This is a duplicate lead.'
4028 and rownum < 2;
4029
4030 cursor c_rec_in_ams is
4031 select count(*) from ams_imp_source_lines
4032 where import_list_header_id = p_import_list_header_id
4033 and load_status in ('ACTIVE','RELOAD');
4034
4035 cursor c_rec_failed_in_ams is
4036 select count(*) from ams_imp_source_lines lines
4037 where lines.import_list_header_id = p_import_list_header_id
4038 and lines.load_status = G_STATUS_ERROR;
4039
4040 /*
4041 cursor c_rec_failed_in_ams is
4042 select count(*) from ams_imp_source_lines lines,
4043 ams_list_import_errors errors
4044 where lines.import_list_header_id = p_import_list_header_id
4045 and lines.load_status = 'ERROR'
4046 and lines.import_list_header_id = errors.import_list_header_id
4047 and lines.IMPORT_SOURCE_LINE_ID = errors.IMPORT_SOURCE_LINE_ID
4048 and errors.batch_id = l_batch_id
4049 and errors.error_type = 'E';
4050 */
4051
4052 cursor c_rec_uploaded_in_as is
4053 select count(*) from as_import_interface
4054 where batch_id = l_batch_id;
4055
4056 cursor c_rec_pro_succ_in_as is
4057 select count(*) from as_import_interface
4058 where batch_id = l_batch_id
4059 and load_status = 'SUCCESS';
4060
4061 cursor c_rec_pro_fail_in_as is
4062 select count(*) from as_import_interface
4063 where batch_id = l_batch_id
4064 and load_status in ('ERROR','T-ERROR','UNEXP_ERROR');
4065
4066
4067 cursor c_loaded_records is
4068 select count(*) from ams_imp_source_lines
4069 where import_list_header_id = p_import_list_header_id
4070 and load_status = G_STATUS_SUCCESS;
4071
4072 cursor c_failed_records is
4073 select count(*) from ams_imp_source_lines
4074 where import_list_header_id = p_import_list_header_id
4075 and load_status = G_STATUS_ERROR;
4076
4077 cursor c_rec_pro_dup_in_as is
4078 select count(*) from as_import_interface
4079 where batch_id = l_batch_id
4080 and load_status = 'DUPLICATE';
4081
4082
4083 BEGIN
4084
4085 AMS_Utility_PVT.Create_Log (
4086 x_return_status => l_return_status,
4087 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4088 p_log_used_by_id => p_import_list_header_id,
4089 p_msg_data => 'Starting import for LEAD.',
4090 p_msg_type => 'DEBUG'
4091 );
4092
4093 open c_conc_name;
4094 fetch c_conc_name into l_conc_prog_name;
4095 close c_conc_name;
4096
4097 open c_rec_in_ams;
4098 fetch c_rec_in_ams into l_rec_in_ams;
4099 close c_rec_in_ams;
4100
4101 /*
4102 SELECT batch_id into l_batch_id FROM as_import_interface
4103 WHERE IMP_LIST_HEADER_NUMBER = p_import_list_header_id AND ROWNUM < 2;
4104 as_import_sl_pvt.main(l_msg_buf,
4105 l_msg_code,
4106 'NEW', -- 'MARKETING',
4107 sysdate,
4108 l_batch_id,
4109 'N'
4110 );
4111 capture_lead_error(p_import_list_header_id);
4112 */
4113 open c_lead_process;
4114 fetch c_lead_process into l_batch_id,l_validate_file, l_execute_mode;
4115 close c_lead_process;
4116
4117 -- Call the Validate Process
4118 if l_validate_file = 'Y' then
4119 AMS_Utility_PVT.Create_Log (
4120 x_return_status => l_return_status,
4121 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4122 p_log_used_by_id => p_import_list_header_id,
4123 p_msg_data => 'Starting Validation for LEAD data.',
4124 p_msg_type => 'DEBUG'
4125 );
4126
4127 -- Delete all the errors from the errors table which are reloaded.
4128 delete from ams_list_import_errors where import_list_header_id
4129 = p_import_list_header_id and import_source_line_id = 0;
4130 delete from ams_list_import_errors where import_list_header_id
4131 = p_import_list_header_id and import_source_line_id in
4132 (select import_source_line_id from ams_imp_source_lines where
4133 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_RELOAD);
4134
4135 x_return_status := null;
4136 execute_lead_data_validation ( p_import_list_header_id,x_return_status );
4137 if x_return_status <> 'S' then
4138 AMS_Utility_PVT.Create_Log (
4139 x_return_status => l_return_status,
4140 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4141 p_log_used_by_id => p_import_list_header_id,
4142 p_msg_data => 'Lead import terminated because of error in Data validation process.',
4143 p_msg_type => 'DEBUG'
4144 );
4145
4146 l_lookup_code := 'ERROR';
4147 l_user_status_id := null;
4148 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4149 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4150 system_status_code = 'ERROR' and default_flag = 'Y';
4151
4152 UPDATE ams_imp_list_headers_all
4153 set status_code = l_lookup_code,
4154 user_status_id = l_user_status_id,
4155 status_date = sysdate
4156 where import_list_header_id = p_import_list_header_id;
4157 return;
4158 end if;
4159
4160 AMS_Utility_PVT.Create_Log (
4161 x_return_status => l_return_status,
4162 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4163 p_log_used_by_id => p_import_list_header_id,
4164 p_msg_data => 'End Validation for LEAD data.',
4165 p_msg_type => 'DEBUG'
4166 );
4167 end if;
4168 open c_rec_failed_in_ams;
4169 fetch c_rec_failed_in_ams into l_rec_failed_in_ams;
4170 close c_rec_failed_in_ams;
4171
4172 -- Uploads the Lead's interface table.
4173 AMS_Utility_PVT.Create_Log (
4174 x_return_status => l_return_status,
4175 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4176 p_log_used_by_id => p_import_list_header_id,
4177 p_msg_data => 'Starting LEAD data upload.',
4178 p_msg_type => 'DEBUG'
4179 );
4180 AMS_ImportClient_PVT.Load_Lead_Data_To_Interface(p_import_list_header_id,x_return_status);
4181 AMS_Utility_PVT.Create_Log (
4182 x_return_status => l_return_status,
4183 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4184 p_log_used_by_id => p_import_list_header_id,
4185 p_msg_data => 'End LEAD data upload.',
4186 p_msg_type => 'DEBUG'
4187 );
4188
4189 if x_return_status <> 'S' then
4190 AMS_Utility_PVT.Create_Log (
4191 x_return_status => l_return_status,
4192 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4193 p_log_used_by_id => p_import_list_header_id,
4194 p_msg_data => 'Lead import terminated because of Data upload error.',
4195 p_msg_type => 'DEBUG'
4196 );
4197
4198 l_lookup_code := 'ERROR';
4199 l_user_status_id := null;
4200 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4201 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4202 system_status_code = 'ERROR' and default_flag = 'Y';
4203
4204 UPDATE ams_imp_list_headers_all
4205 set status_code = l_lookup_code,
4206 user_status_id = l_user_status_id,
4207 status_date = sysdate
4208 where import_list_header_id = p_import_list_header_id;
4209 return;
4210 end if;
4211
4212 open c_lead_source_system;
4213 fetch c_lead_source_system into l_source_system;
4214 close c_lead_source_system;
4215 if l_source_system is NULL then
4216 AMS_Utility_PVT.Create_Log (
4217 x_return_status => l_return_status,
4218 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4219 p_log_used_by_id => p_import_list_header_id,
4220 p_msg_data => 'Aborting import process because SOURCE_SYSTEM is NULL.',
4221 p_msg_type => 'DEBUG'
4222 );
4223 open c_rec_failed_in_ams;
4224 fetch c_rec_failed_in_ams into l_rec_failed_in_ams;
4225 close c_rec_failed_in_ams;
4226
4227 l_lookup_code := 'ERROR';
4228 l_user_status_id := null;
4229 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4230 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4231 system_status_code = 'ERROR' and default_flag = 'Y';
4232
4233 UPDATE ams_imp_list_headers_all
4234 set status_code = l_lookup_code,
4235 user_status_id = l_user_status_id,
4236 status_date = sysdate,
4237 number_of_failed_records = l_rec_failed_in_ams
4238 where import_list_header_id = p_import_list_header_id;
4239
4240 return;
4241 end if;
4242
4243 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
4244 application => 'AS', -- 'AST',
4245 program => l_conc_prog_name, -- ' ASXSLIMP' 'AST_LEAD_IMPORT',
4246 argument1 => l_source_system, -- 'NEW', -- 'ORACLE.COM',
4247 argument2 => NULL,
4248 argument3 => l_batch_id, -- NULL,
4249 argument4 => 'N'
4250 );
4251
4252 AMS_Utility_PVT.Create_Log (
4253 x_return_status => l_return_status,
4254 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4255 p_log_used_by_id => p_import_list_header_id,
4256 p_msg_data => 'Starting LEAD program (ASXSLIMP) -- concurrent program_id is '||to_char(l_request_id),
4257 p_msg_type => 'DEBUG'
4258 );
4259
4260 IF l_request_id = 0 THEN
4261 l_mesg_text := fnd_message.get;
4262 AMS_Utility_PVT.Create_Log (
4263 x_return_status => l_return_status,
4264 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4265 p_log_used_by_id => p_import_list_header_id,
4266 p_msg_data => l_mesg_text,
4267 p_msg_type => 'DEBUG' );
4268
4269 l_user_status_id := null;
4270 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4271 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4272 system_status_code = 'ERROR' and default_flag = 'Y';
4273 UPDATE ams_imp_list_headers_all
4274 set status_code = l_lookup_code,
4275 user_status_id = l_user_status_id,
4276 status_date = sysdate
4277 where import_list_header_id = p_import_list_header_id;
4278 commit;
4279 RAISE FND_API.g_exc_unexpected_error;
4280 end if;
4281
4282 commit;
4283 -- The concurrent program MUST finish
4284 -- before updating the status_code
4285
4286 l_wait_status := FND_CONCURRENT.WAIT_FOR_REQUEST (
4287 request_id => l_request_id,
4288 phase => l_phase,
4289 status => l_status,
4290 dev_phase => l_dev_phase,
4291 dev_status => l_dev_status,
4292 message => l_message
4293 );
4294
4295 ---------------------------------------------
4296 -- WAIT_STATUS should only come back as
4297 -- TRUE. It only comes back as FALSE if
4298 -- the conc request was not successfully
4299 -- submitted.
4300 ---------------------------------------------
4301 IF NOT l_wait_status THEN
4302 RAISE FND_API.g_exc_unexpected_error;
4303 END IF;
4304
4305
4306 l_rstatus := FND_CONCURRENT.get_REQUEST_status (
4307 request_id => l_request_id,
4308 APPL_SHORTNAME => l_appli,
4309 program => l_prog,
4310 phase => l_phase,
4311 status => l_status,
4312 dev_phase => l_dev_phase,
4313 dev_status => l_dev_status,
4314 message => l_message
4315 );
4316 if l_dev_phase = 'COMPLETE' then
4317 /*
4318 if l_dev_status = 'NORMAL' then
4319 l_lookup_code := 'COMPLETED';
4320 l_user_status_id := null;
4321 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4322 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4323 system_status_code = 'COMPLETED' and default_flag = 'Y';
4324 end if;
4325 */
4326 if l_dev_status = 'ERROR' then
4327 l_lookup_code := 'ERROR';
4328 l_user_status_id := null;
4329 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4330 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4331 system_status_code = 'ERROR' and default_flag = 'Y';
4332 UPDATE ams_imp_list_headers_all
4333 set status_code = l_lookup_code,
4334 user_status_id = l_user_status_id,
4335 status_date = sysdate
4336 where import_list_header_id = p_import_list_header_id;
4337 AMS_Utility_PVT.Create_Log (
4338 x_return_status => l_return_status,
4339 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4340 p_log_used_by_id => p_import_list_header_id,
4341 p_msg_data => 'LEAD program completed with errors Please check the log file.',
4342 p_msg_type => 'DEBUG'
4343 );
4344 end if;
4345
4346 -- Post process for Lead import.
4347 AMS_Utility_PVT.Create_Log (
4348 x_return_status => l_return_status,
4349 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4350 p_log_used_by_id => p_import_list_header_id,
4351 p_msg_data => 'Starting LEAD post process.',
4352 p_msg_type => 'DEBUG'
4353 );
4354 AMS_ImportClient_PVT.Mark_Insert_Lead_Errors(p_import_list_header_id,x_return_status);
4355 AMS_Utility_PVT.Create_Log (
4356 x_return_status => l_return_status,
4357 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4358 p_log_used_by_id => p_import_list_header_id,
4359 p_msg_data => 'End LEAD post process.',
4360 p_msg_type => 'DEBUG'
4361 );
4362 end if;
4363
4364 open c_lead_status;
4365 fetch c_lead_status into l_lead_status;
4366 close c_lead_status;
4367 if l_lead_status = 'ERROR' then
4368 /*
4369 l_lookup_code := 'ERROR';
4370 l_user_status_id := null;
4371 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
4372 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
4373 system_status_code = 'ERROR' and default_flag = 'Y';
4374 */
4375 AMS_Utility_PVT.Create_Log (
4376 x_return_status => l_return_status,
4377 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4378 p_log_used_by_id => p_import_list_header_id,
4379 p_msg_data => 'Some of the leads in the batch has errors.',
4380 p_msg_type => 'DEBUG'
4381 );
4382 /*
4383 UPDATE ams_imp_list_headers_all
4384 set status_code = l_lookup_code,
4385 user_status_id = l_user_status_id,
4386 status_date = sysdate
4387 where import_list_header_id = p_import_list_header_id;
4388 */
4389 end if;
4390
4391 -- capture_lead_error(p_import_list_header_id);
4392
4393 AMS_Utility_PVT.Create_Log (
4394 x_return_status => l_return_status,
4395 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4396 p_log_used_by_id => p_import_list_header_id,
4397 p_msg_data => 'End client load for LEAD.',
4398 p_msg_type => 'DEBUG'
4399 );
4400 AMS_Utility_PVT.Create_Log (
4401 x_return_status => l_return_status,
4402 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4403 p_log_used_by_id => p_import_list_header_id,
4404 p_msg_data => 'Processing is done for Batch : '||to_char(l_batch_id),
4405 p_msg_type => 'DEBUG'
4406 );
4407
4408 AMS_Utility_PVT.Create_Log (
4409 x_return_status => l_return_status,
4410 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4411 p_log_used_by_id => p_import_list_header_id,
4412 p_msg_data => 'Records available for process : '||to_char(l_rec_in_ams),
4413 p_msg_type => 'DEBUG'
4414 );
4415
4416 AMS_Utility_PVT.Create_Log (
4417 x_return_status => l_return_status,
4418 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4419 p_log_used_by_id => p_import_list_header_id,
4420 p_msg_data => 'Records failed data validation : '||to_char(l_rec_failed_in_ams),
4421 p_msg_type => 'DEBUG'
4422 );
4423
4424 open c_rec_uploaded_in_as;
4425 fetch c_rec_uploaded_in_as into l_rec_in_as;
4426 close c_rec_uploaded_in_as;
4427 AMS_Utility_PVT.Create_Log (
4428 x_return_status => l_return_status,
4429 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4430 p_log_used_by_id => p_import_list_header_id,
4431 p_msg_data => 'Records uploaded/available for Lead import process : '||to_char(l_rec_in_as),
4432 p_msg_type => 'DEBUG'
4433 );
4434
4435 open c_rec_pro_fail_in_as;
4436 fetch c_rec_pro_fail_in_as into l_rec_fail_in_as;
4437 close c_rec_pro_fail_in_as;
4438 AMS_Utility_PVT.Create_Log (
4439 x_return_status => l_return_status,
4440 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4441 p_log_used_by_id => p_import_list_header_id,
4442 p_msg_data => 'Records failed during Lead import process : '||to_char(l_rec_fail_in_as),
4443 p_msg_type => 'DEBUG'
4444 );
4445
4446
4447 open c_rec_pro_succ_in_as;
4448 fetch c_rec_pro_succ_in_as into l_rec_succ_in_as;
4449 close c_rec_pro_succ_in_as;
4450 AMS_Utility_PVT.Create_Log (
4451 x_return_status => l_return_status,
4452 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4453 p_log_used_by_id => p_import_list_header_id,
4454 p_msg_data => 'Records successfully processed Lead import : '||to_char(l_rec_succ_in_as),
4455 p_msg_type => 'DEBUG'
4456 );
4457 l_rec_dup_in_as := null;
4458 open c_rec_pro_dup_in_as;
4459 fetch c_rec_pro_dup_in_as into l_rec_dup_in_as;
4460 close c_rec_pro_dup_in_as;
4461 if nvl(l_rec_dup_in_as,0) > 0 then
4462 AMS_Utility_PVT.Create_Log (
4463 x_return_status => l_return_status,
4464 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4465 p_log_used_by_id => p_import_list_header_id,
4466 p_msg_data => 'Duplicate Leads in Lead import process : '||to_char(l_rec_dup_in_as),
4467 p_msg_type => 'DEBUG'
4468 );
4469 end if;
4470
4471 -- Delete all the errors from the errors table which are sucessful.
4472 delete from ams_list_import_errors where import_list_header_id
4473 = p_import_list_header_id and import_source_line_id in
4474 (select import_source_line_id from ams_imp_source_lines where
4475 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_SUCCESS);
4476
4477 -- STATUS CODE PROCESS
4478
4479 process_status_code (p_import_list_header_id);
4480
4481
4482 exception
4483 when others then
4484 AMS_Utility_PVT.Create_Log (
4485 x_return_status => l_ret_status,
4486 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
4487 p_log_used_by_id => p_import_list_header_id,
4488 p_msg_data => sqlerrm ,
4489 p_msg_type => 'DEBUG'
4490 );
4491 raise;
4492
4493 END execute_lead_import;
4494
4495
4496 --
4497 --
4498 -- This progam updates the party for the rented list
4499 --
4500 PROCEDURE update_rented_list_party (
4501 p_party_id IN NUMBER,
4502 p_return_status OUT NOCOPY VARCHAR2,
4503 p_msg_count OUT NOCOPY NUMBER,
4504 p_msg_data OUT NOCOPY VARCHAR2
4505
4506 ) IS
4507
4508 x_b2b varchar(30);
4509 x_rented_list_flag varchar(1);
4510 x_email_address varchar2(2000);
4511 x_phone_country_code VARCHAR2(10);
4512 x_phone_area_code VARCHAR2(10);
4513 x_phone_number VARCHAR2(40);
4514 x_phone_extention VARCHAR2(20);
4515 x_date1 DATE := sysdate;
4516 l_last_update_date DATE;
4517 l_last_update_date1 DATE;
4518 x_profile_id NUMBER;
4519 x_return_status VARCHAR2(100);
4520 x_msg_count NUMBER;
4521 x_msg_data VARCHAR2(2000);
4522 x_tmp_var VARCHAR2(2000);
4523 x_tmp_var1 VARCHAR2(2000);
4524 X_PARTY_REL_PARTY_ID NUMBER;
4525 x_relationship_id NUMBER;
4526 x_org_contact_id NUMBER;
4527 x_date_one DATE := sysdate;
4528 x_date_two DATE := sysdate;
4529 x_date_three DATE := sysdate;
4530 x_org_party_id NUMBER;
4531 x_person_id NUMBER;
4532 x_gen_party_site_number VARCHAR2(1);
4533 x_hz_dup_check VARCHAR2(60);
4534 x_import_list_header_id NUMBER;
4535 x_location_id number;
4536 l_lp_psite_id NUMBER;
4537 x_Party_site_id number;
4538 x_party_site_number VARCHAR2(30);
4539 l_phone_exists VARCHAR2(1);
4540 l_email_exists VARCHAR2(1);
4541 x_contact_point_id number;
4542 x_per_party_id number;
4543 l_object_version number;
4544 l_object_version2 number;
4545 l_object_version3 number;
4546 -- Cursor for B2B party type
4547
4548 cursor b2b is
4549 SELECT
4550 IMPORT_SOURCE_LINE_ID,
4551 PARTY_NAME,
4552 FISCAL_YEAREND_MONTH,
4553 DUNS_NUMBER,
4554 EMPLOYEES_TOTAL,
4555 LINE_OF_BUSINESS,
4556 YEAR_ESTABLISHED,
4557 TAX_REFERENCE,
4558 CEO_NAME,
4559 PERSON_FIRST_NAME,
4560 PERSON_MIDDLE_NAME,
4561 PERSON_LAST_NAME,
4562 PERSON_NAME_SUFFIX,
4563 PERSON_name_prefix,
4564 -- BEST_TIME_CONTACT_BEGIN,
4565 -- BEST_TIME_CONTACT_END,
4566 COUNTRY,
4567 ADDRESS1,
4568 ADDRESS2,
4569 CITY,
4570 COUNTY,
4571 STATE,
4572 PROVINCE,
4573 POSTAL_CODE,
4574 -- TIME_ZONE,
4575 EMAIL_ADDRESS,
4576 PHONE_COUNTRY_CODE,
4577 PHONE_AREA_CODE,
4578 PHONE_NUMBER,
4579 PHONE_EXTENTION,
4580 DEPARTMENT,
4581 JOB_TITLE,
4582 DECISION_MAKER_FLAG,
4583 SIC_CODE,
4584 SIC_CODE_TYPE,
4585 -- TOTAL_NUM_OF_ORDERS,
4586 -- TOTAL_ORDERED_AMOUNT,
4587 -- LAST_ORDERED_DATE ,
4588 ANALYSIS_FY ,
4589 CURR_FY_POTENTIAL_REVENUE,
4590 NEXT_FY_POTENTIAL_REVENUE,
4591 GSA_INDICATOR_FLAG ,
4592 MISSION_STATEMENT ,
4593 ORGANIZATION_NAME_PHONETIC,
4594 CATEGORY_CODE ,
4595 JGZZ_FISCAL_CODE ,
4596 -- TAX_NAME ,
4597 ADDRESS3 ,
4598 ADDRESS4 ,
4599 ADDRESS_LINES_PHONETIC ,
4600 -- APARTMENT_FLAG ,
4601 -- bug 4641591: columns obsolete
4602 -- PO_BOX_NUMBER ,
4603 -- HOUSE_NUMBER ,
4604 -- STREET_SUFFIX ,
4605 -- SECONDARY_SUFFIX_ELENENT ,
4606 -- STREET ,
4607 -- RURAL_ROUTE_TYPE ,
4608 -- RURAL_ROUTE_NUMBER ,
4609 -- STREET_NUMBER ,
4610 -- FLOOR ,
4611 -- SUITE ,
4612 POSTAL_PLUS4_CODE ,
4613 -- OVERSEAS_ADDRESS_FLAG ,
4614 identifying_address_flag ,
4615 to_date(ADDRESS_EFFECTIVE_DATE,'MM/DD/YYYY'),
4616 to_date(ADDRESS_EXPIRATION_DATE,'MM/DD/YYYY'),
4617 --ANNUAL_REVENUE,
4618 --ANNUAL_REVENUE_CURRENCY,
4619 BRANCH_FLAG,
4620 BUSINESS_LINE,
4621 BUSINESS_SCOPE,
4622 CHIEF_EXECUTIVE_TITLE,
4623 CONGRESSIONAL_DISTRICT_CODE,
4624 CONTROL_YEAR,
4625 CORPORATION_CLASS,
4626 CREDIT_SCORE,
4627 CREDIT_SCORE_COMMENTARY,
4628 --CUSTOMER_CATEGORY,
4629 DB_RATING,
4630 to_date(DATE_OF_BIRTH,'MM/DD/YYYY'),
4631 to_date(DATE_OF_DEATH,'MM/DD/YYYY'),
4632 DEBARMENTS_COUNT,
4633 to_date(DEBARTMENTS_DATE,'MM/DD/YYYY'),
4634 DECLARED_ETHNICITY,
4635 DEPARTMENT_INDICATOR,
4636 DESCRIPTION,
4637 DISADVANTAGED_INDICATOR,
4638 ENQUIRY_DUNS,
4639 EXPORT_INDICATOR,
4640 FAILURE_SCORE,
4641 FAILURE_SCORE_COMMENTARY,
4642 FAILURE_SCORE_NATL_PERCENTILE,
4643 FAILURE_SCORE_OVERRIDE_CODE,
4644 --FISCAL_CODE,
4645 GLOBAL_FAILURE_SCORE,
4646 HEADQUARTER_BRANCH_INDICATOR,
4647 HEAD_OF_HOUSEHOLD_FLAG,
4648 HOUSEHOLD_SIZE,
4649 IMPORT_INDICATOR,
4650 ORGANIZATION_KNOWN_AS,
4651 ORGANIZATION_KNOWN_AS2,
4652 ORGANIZATION_KNOWN_AS3,
4653 ORGANIZATION_KNOWN_AS4,
4654 ORGANIZATION_KNOWN_AS5,
4655 PERSON_KNOWN_AS,
4656 PERSON_KNOWN_AS2,
4657 PERSON_KNOWN_AS3,
4658 PERSON_KNOWN_AS4,
4659 PERSON_KNOWN_AS5,
4660 LABOR_SURPLUS_INDICATOR,
4661 LOCAL_ACTIVITY_CODE,
4662 LOCAL_ACTIVITY_CODE_TYPE,
4663 LOCATION_DIRECTIONS ,
4664 --LOCATION_STATUS,
4665 MARITAL_STATUS,
4666 to_date(MARITAL_STATUS_EFFECTIVE_DATE,'MM/DD/YYYY'),
4667 MINORITY_OWNED_INDICATOR,
4668 MINORITY_OWNED_TYPE,
4669 --ORGANIZATION_ALIAS,
4670 ORGANIZATION_TYPE,
4671 ORGANIZATION_URL,
4672 OUT_OF_BUSINESS_INDICATOR,
4673 PERSONAL_INCOME,
4674 PERSON_ACADEMIC_TITLE,
4675 PERSON_FIRST_NAME_PHONETIC,
4676 PERSON_LAST_NAME_PHONETIC,
4677 MIDDLE_NAME_PHONETIC,
4678 PERSON_NAME_PHONETIC,
4679 PERSON_PREVIOUS_TITLE_NAME,
4680 PLACE_OF_BIRTH,
4681 --PREFERRED_NAME,
4682 PRINCIPAL_NAME,
4683 PRINCIPAL_TITLE,
4684 PUBLIC_PRIVATE_OWNERSHIP_FLAG,
4685 RENT_OWNED_INDICATOR,
4686 --RENT_OWNER_INDICATOR,
4687 SECOND_TITLE,
4688 SHORT_DESCRIPTION,
4689 SMALL_BUSINESS_INDICATOR,
4690 TAX_ID,
4691 WOMAN_OWNED_INDICATOR,
4692 ORGANIZATION_ATTRIBUTE1,
4693 ORGANIZATION_ATTRIBUTE2,
4694 ORGANIZATION_ATTRIBUTE3,
4695 ORGANIZATION_ATTRIBUTE4,
4696 ORGANIZATION_ATTRIBUTE5,
4697 ORGANIZATION_ATTRIBUTE6,
4698 ORGANIZATION_ATTRIBUTE7,
4699 ORGANIZATION_ATTRIBUTE8,
4700 ORGANIZATION_ATTRIBUTE9,
4701 ORGANIZATION_ATTRIBUTE10,
4702 ORGANIZATION_ATTRIBUTE11,
4703 ORGANIZATION_ATTRIBUTE12,
4704 ORGANIZATION_ATTRIBUTE13,
4705 ORGANIZATION_ATTRIBUTE14,
4706 ORGANIZATION_ATTRIBUTE15,
4707 PERSON_ATTRIBUTE1,
4708 PERSON_ATTRIBUTE2,
4709 PERSON_ATTRIBUTE3,
4710 PERSON_ATTRIBUTE4,
4711 PERSON_ATTRIBUTE5,
4712 PERSON_ATTRIBUTE6,
4713 PERSON_ATTRIBUTE7,
4714 PERSON_ATTRIBUTE8,
4715 PERSON_ATTRIBUTE9,
4716 PERSON_ATTRIBUTE10,
4717 PERSON_ATTRIBUTE11,
4718 PERSON_ATTRIBUTE12,
4719 PERSON_ATTRIBUTE13,
4720 PERSON_ATTRIBUTE14,
4721 PERSON_ATTRIBUTE15,
4722 ORG_CONTACT_ATTRIBUTE1,
4723 ORG_CONTACT_ATTRIBUTE2,
4724 ORG_CONTACT_ATTRIBUTE3,
4725 ORG_CONTACT_ATTRIBUTE4,
4726 ORG_CONTACT_ATTRIBUTE5,
4727 ORG_CONTACT_ATTRIBUTE6,
4728 ORG_CONTACT_ATTRIBUTE7,
4729 ORG_CONTACT_ATTRIBUTE8,
4730 ORG_CONTACT_ATTRIBUTE9,
4731 ORG_CONTACT_ATTRIBUTE10,
4732 ORG_CONTACT_ATTRIBUTE11,
4733 ORG_CONTACT_ATTRIBUTE12,
4734 ORG_CONTACT_ATTRIBUTE13,
4735 ORG_CONTACT_ATTRIBUTE14,
4736 ORG_CONTACT_ATTRIBUTE15,
4737 ADDRESS_ATTRIBUTE1,
4738 ADDRESS_ATTRIBUTE2,
4739 ADDRESS_ATTRIBUTE3,
4740 ADDRESS_ATTRIBUTE4,
4741 ADDRESS_ATTRIBUTE5,
4742 ADDRESS_ATTRIBUTE6,
4743 ADDRESS_ATTRIBUTE7,
4744 ADDRESS_ATTRIBUTE8,
4745 ADDRESS_ATTRIBUTE9,
4746 ADDRESS_ATTRIBUTE10,
4747 ADDRESS_ATTRIBUTE11,
4748 ADDRESS_ATTRIBUTE12,
4749 ADDRESS_ATTRIBUTE13,
4750 ADDRESS_ATTRIBUTE14,
4751 ADDRESS_ATTRIBUTE15,
4752 FAX_COUNTRY_CODE,
4753 FAX_AREA_CODE,
4754 FAX_NUMBER,
4755 ORG_ATTRIBUTE_CATEGORY,
4756 PERSON_ATTRIBUTE_CATEGORY,
4757 ORG_CONTACT_ATTRIBUTE_CATEGORY,
4758 ADDRESS_ATTRIBUTE_CATEGORY ,
4759 PARTY_SITE_USE
4760
4761 FROM AMS_HZ_B2B_MAPPING_V
4762 WHERE party_id = p_party_id
4763 and load_status = 'SUCCESS';
4764
4765 -- Cursor B2C Party Type
4766
4767 CURSOR B2C IS
4768 SELECT
4769 IMPORT_SOURCE_LINE_ID,
4770 PERSON_FIRST_NAME,
4771 PERSON_MIDDLE_NAME,
4772 PERSON_LAST_NAME,
4773 PERSON_NAME_SUFFIX,
4774 PERSON_name_prefix,
4775 -- BEST_TIME_CONTACT_BEGIN,
4776 -- BEST_TIME_CONTACT_END,
4777 COUNTRY,
4778 ADDRESS1,
4779 ADDRESS2,
4780 CITY,
4781 COUNTY,
4782 STATE,
4783 PROVINCE,
4784 POSTAL_CODE,
4785 -- TIME_ZONE,
4786 EMAIL_ADDRESS,
4787 PHONE_COUNTRY_CODE,
4788 PHONE_AREA_CODE,
4789 PHONE_NUMBER,
4790 PHONE_EXTENTION,
4791 -- PERSON_PRE_NAME_ADJUNCT,
4792 SALUTATION,
4793 ADDRESS3 ,
4794 ADDRESS4 ,
4795 ADDRESS_LINES_PHONETIC ,
4796 -- APARTMENT_FLAG ,
4797 -- bug 4641591: columns obsolete
4798 -- PO_BOX_NUMBER ,
4799 -- HOUSE_NUMBER ,
4800 -- STREET_SUFFIX ,
4801 -- SECONDARY_SUFFIX_ELEMENT ,
4802 -- STREET ,
4803 -- RURAL_ROUTE_TYPE ,
4804 -- RURAL_ROUTE_NUMBER ,
4805 -- STREET_NUMBER ,
4806 -- FLOOR ,
4807 -- SUITE ,
4808 POSTAL_PLUS4_CODE ,
4809 -- OVERSEAS_ADDRESS_FLAG ,
4810 identifying_address_flag ,
4811 PERSON_LAST_NAME_PHONETIC,
4812 PERSON_FIRST_NAME_PHONETIC ,
4813 --PREFERRED_NAME,
4814 URL,-- replace PREFERRED_NAME with URL
4815 SECOND_TITLE,
4816 to_date(DATE_OF_BIRTH,'MM/DD/YYYY'),
4817 PERSON_ACADEMIC_TITLE,
4818 PERSON_PREVIOUS_TITLE_NAME,
4819 PERSON_KNOWN_AS,
4820 PERSON_KNOWN_AS2,
4821 PERSON_KNOWN_AS3,
4822 PERSON_KNOWN_AS4,
4823 PERSON_KNOWN_AS5,
4824 PERSON_NAME_PHONETIC,
4825 MIDDLE_NAME_PHONETIC,
4826 FISCAL_CODE,
4827 PLACE_OF_BIRTH,
4828 to_date(DATE_OF_DEATH,'MM/DD/YYYY'),
4829 DECLARED_ETHNICITY,
4830 MARITAL_STATUS, PERSONAL_INCOME,
4831 to_date(MARITAL_STATUS_EFFECTIVE_DATE,'MM/DD/YYYY'),
4832 HEAD_OF_HOUSEHOLD_FLAG,
4833 HOUSEHOLD_SIZE, LOCATION_DIRECTIONS,
4834 ADDRESS_EFFECTIVE_DATE, ADDRESS_EXPIRATION_DATE,
4835 PERSON_ATTRIBUTE1, PERSON_ATTRIBUTE2,
4836 PERSON_ATTRIBUTE3, PERSON_ATTRIBUTE4,
4837 PERSON_ATTRIBUTE5, PERSON_ATTRIBUTE6,
4838 PERSON_ATTRIBUTE7, PERSON_ATTRIBUTE8,
4839 PERSON_ATTRIBUTE9, PERSON_ATTRIBUTE10,
4840 PERSON_ATTRIBUTE11, PERSON_ATTRIBUTE12,
4841 PERSON_ATTRIBUTE13, PERSON_ATTRIBUTE14,
4842 PERSON_ATTRIBUTE15, ADDRESS_ATTRIBUTE1,
4843 ADDRESS_ATTRIBUTE2, ADDRESS_ATTRIBUTE3,
4844 ADDRESS_ATTRIBUTE4, ADDRESS_ATTRIBUTE5,
4845 ADDRESS_ATTRIBUTE6, ADDRESS_ATTRIBUTE7,
4846 ADDRESS_ATTRIBUTE8, ADDRESS_ATTRIBUTE9,
4847 ADDRESS_ATTRIBUTE10, ADDRESS_ATTRIBUTE11,
4848 ADDRESS_ATTRIBUTE12, ADDRESS_ATTRIBUTE13,
4849 ADDRESS_ATTRIBUTE14, ADDRESS_ATTRIBUTE15,
4850 FAX_COUNTRY_CODE, FAX_AREA_CODE,
4851 FAX_NUMBER,
4852 PERSON_ATTRIBUTE_CATEGORY,
4853 ADDRESS_ATTRIBUTE_CATEGORY ,
4854 SHORT_DESCRIPTION,
4855 DESCRIPTION,
4856 PARTY_SITE_USE
4857 FROM AMS_HZ_B2C_MAPPING_V
4858 WHERE party_id = p_party_id
4859 and load_status = 'SUCCESS';
4860
4861
4862 cursor b2borb2c is
4863 select hd.import_type, hd.rented_list_flag, hd.import_list_header_id
4864 from ams_imp_list_headers_all hd, ams_imp_source_lines sr
4865 where hd.import_list_header_id = sr.import_list_header_id
4866 and sr.party_id = p_party_id;
4867
4868 cursor c_relationship is
4869 SELECT RELATIONSHIP_ID, OBJECT_VERSION_NUMBER FROM hz_relationships WHERE subject_type = 'PERSON'
4870 AND party_id = p_party_id;
4871
4872 CURSOR LOCATION_EXISTS IS
4873 SELECT party_site_id FROM hz_party_sites
4874 WHERE party_id = x_org_party_id
4875 AND location_id = x_location_id;
4876
4877 CURSOR CHECK_PSITE_EXISTS IS
4878 SELECT party_site_id FROM hz_party_sites
4879 WHERE party_id = x_party_rel_party_id
4880 AND location_id = x_location_id;
4881
4882 CURSOR phone_exists (x_hz_party_id number) IS
4883 SELECT 'Y' FROM hz_contact_points
4884 WHERE contact_point_type = 'PHONE'
4885 AND phone_line_type = 'GEN'
4886 AND owner_table_name = 'HZ_PARTIES'
4887 AND owner_table_id = x_hz_party_id
4888 AND phone_number = x_phone_number
4889 AND NVL(phone_country_code,'x') = NVL(x_phone_country_code,'x')
4890 AND NVL(phone_area_code,'x') = NVL(x_phone_area_code,'x')
4891 AND NVL(phone_extension,'x') = NVL(x_phone_extention,'x');
4892
4893
4894 CURSOR email_exists (x_hz_party_id number) IS
4895 SELECT 'Y' FROM hz_contact_points
4896 WHERE contact_point_type = 'EMAIL'
4897 AND owner_table_name = 'HZ_PARTIES'
4898 AND owner_table_id = x_hz_party_id
4899 AND email_address = x_email_address;
4900
4901 CURSOR PER_LOCATION_EXISTS IS
4902 SELECT party_site_id FROM hz_party_sites
4903 WHERE party_id = x_per_party_id
4904 AND location_id = x_location_id;
4905
4906 party_rec hz_party_v2pub.party_rec_type;
4907 org_rec hz_party_v2pub.organization_rec_type;
4908 person_rec hz_party_v2pub.person_rec_type;
4909 location_rec hz_location_v2pub.location_rec_type;
4910 psite_rec hz_party_site_v2pub.party_site_rec_type;
4911 psiteuse_rec hz_party_site_v2pub.party_site_use_rec_type;
4912 cpoint_rec hz_contact_point_v2pub.contact_point_rec_type;
4913 email_rec hz_contact_point_v2pub.email_rec_type;
4914 phone_rec hz_contact_point_v2pub.phone_rec_type;
4915 ocon_rec hz_party_contact_v2pub.org_contact_rec_type;
4916 edi_rec hz_contact_point_v2pub.edi_rec_type;
4917 telex_rec hz_contact_point_v2pub.telex_rec_type;
4918 web_rec hz_contact_point_v2pub.web_rec_type;
4919 fax_rec hz_contact_point_v2pub.phone_rec_type;
4920
4921
4922 begin
4923
4924 x_gen_party_site_number := fnd_profile.value('HZ_GENERATE_PARTY_SITE_NUMBER');
4925 x_hz_dup_check := fnd_profile.value('AMS_HZ_DEDUPE_RULE');
4926 if x_hz_dup_check <> 'Y' then
4927 x_hz_dup_check := 'N';
4928 end if;
4929 -- Checks if it's B2B or B2C party type.
4930 OPEN b2borb2c;
4931 FETCH b2borb2c into x_b2b,x_rented_list_flag,x_import_list_header_id;
4932 CLOSE b2borb2c;
4933
4934 if x_rented_list_flag <> 'R' then
4935 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4936 FND_MESSAGE.SET_NAME('AMS', 'API_DEBUG_MESSAGE');
4937 FND_MESSAGE.SET_TOKEN('ROW','Party was not created through rented list.');
4938 FND_MESSAGE.SET_TOKEN('ERROR' ,SQLERRM);
4939 FND_MSG_PUB.ADD;
4940 ROLLBACK;
4941 RETURN;
4942 end if;
4943
4944 if x_b2b = 'B2B' then
4945 SELECT subject_id into x_org_party_id FROM hz_relationships WHERE subject_type = 'ORGANIZATION'
4946 AND party_id = p_party_id;
4947 OPEN b2b;
4948 FETCH b2b into
4949 org_rec.party_rec.orig_system_reference,
4950 org_rec.organization_name,
4951 org_rec.fiscal_yearend_month,
4952 org_rec.duns_number_c,
4953 org_rec.employees_total,
4954 org_rec.line_of_business,
4955 org_rec.year_established,
4956 org_rec.tax_reference,
4957 org_rec.ceo_name,
4958 person_rec.person_first_name,
4959 person_rec.person_middle_name,
4960 person_rec.person_last_name,
4961 person_rec.person_name_suffix,
4962 person_rec.person_pre_name_adjunct,
4963 -- person_rec.best_time_contact_begin,
4964 -- person_rec.best_time_contact_end,
4965 location_rec.country,
4966 location_rec.address1,
4967 location_rec.address2,
4968 location_rec.city,
4969 location_rec.county,
4970 location_rec.state,
4971 location_rec.province,
4972 location_rec.postal_code,
4973 -- location_rec.time_zone,
4974 x_email_address,
4975 x_phone_country_code,
4976 x_phone_area_code,
4977 x_phone_number,
4978 x_phone_extention,
4979 ocon_rec.department,
4980 ocon_rec.job_title,
4981 ocon_rec.decision_maker_flag,
4982 org_rec.sic_code,
4983 org_rec.sic_code_type,
4984 -- org_rec.party_rec.TOTAL_NUM_OF_ORDERS,
4985 -- org_rec.party_rec.TOTAL_ORDERED_AMOUNT,
4986 -- org_rec.party_rec.LAST_ORDERED_DATE,
4987 org_rec.analysis_fy,
4988 org_rec.CURR_FY_POTENTIAL_REVENUE,
4989 org_rec.NEXT_FY_POTENTIAL_REVENUE,
4990 org_rec.GSA_INDICATOR_FLAG,
4991 org_rec.MISSION_STATEMENT,
4992 org_rec.ORGANIZATION_NAME_PHONETIC,
4993 org_rec.party_rec.CATEGORY_CODE,
4994 org_rec.JGZZ_FISCAL_CODE,
4995 -- org_rec.TAX_NAME,
4996 location_rec.ADDRESS3,
4997 location_rec.ADDRESS4,
4998 location_rec.ADDRESS_LINES_PHONETIC,
4999 -- location_rec.APARTMENT_FLAG,
5000 -- bug 4641591: columns obsolete
5001 -- location_rec.PO_BOX_NUMBER,
5002 -- location_rec.HOUSE_NUMBER,
5003 -- location_rec.STREET_SUFFIX,
5004 -- location_rec.SECONDARY_SUFFIX_ELEMENT,
5005 -- location_rec.STREET,
5006 -- location_rec.RURAL_ROUTE_TYPE,
5007 -- location_rec.RURAL_ROUTE_NUMBER,
5008 -- location_rec.STREET_NUMBER,
5009 -- location_rec.FLOOR,
5010 -- location_rec.SUITE,
5011 location_rec.POSTAL_PLUS4_CODE,
5012 -- location_rec.OVERSEAS_ADDRESS_FLAG,
5013 psite_rec.identifying_address_flag,
5014
5015 location_rec.ADDRESS_EFFECTIVE_DATE,
5016 location_rec.ADDRESS_EXPIRATION_DATE,
5017 org_rec.BRANCH_FLAG,
5018 org_rec.line_of_business,
5019 org_rec.BUSINESS_SCOPE,
5020 org_rec.ceo_title,
5021 org_rec.cong_dist_code,
5022 org_rec.control_yr,
5023 org_rec.corporation_class,
5024 org_rec.credit_score,
5025 org_rec.credit_score_commentary,
5026 org_rec.DB_RATING,
5027 person_rec.DATE_OF_BIRTH,
5028 person_rec.DATE_OF_DEATH,
5029 org_rec.debarments_count,
5030 org_rec.debarments_date,
5031 person_rec.DECLARED_ETHNICITY,
5032 org_rec.debarment_ind,
5033 location_rec.description,
5034 org_rec.disadv_8a_ind,
5035 org_rec.ENQUIRY_DUNS,
5036 org_rec.export_ind,
5037 org_rec.failure_score,
5038 org_rec.FAILURE_SCORE_COMMENTARY,
5039 org_rec.failure_score_natnl_percentile,
5040 org_rec.FAILURE_SCORE_OVERRIDE_CODE,
5041 org_rec.GLOBAL_FAILURE_SCORE,
5042 org_rec.hq_branch_ind,
5043 person_rec.HEAD_OF_HOUSEHOLD_FLAG,
5044 person_rec.HOUSEHOLD_SIZE,
5045 org_rec.import_ind,
5046 org_rec.known_as,
5047 org_rec.known_as2,
5048 org_rec.known_as3,
5049 org_rec.known_as4,
5050 org_rec.known_as5,
5051 person_rec.KNOWN_AS,
5052 person_rec.KNOWN_AS2,
5053 PERSON_rec.KNOWN_AS3,
5054 PERSON_rec.KNOWN_AS4,
5055 PERSON_rec.KNOWN_AS5,
5056 org_rec.labor_surplus_ind,
5057 org_rec.LOCAL_ACTIVITY_CODE,
5058 org_rec.LOCAL_ACTIVITY_CODE_TYPE,
5059 location_rec.LOCATION_DIRECTIONS ,
5060 person_rec.MARITAL_STATUS,
5061 person_rec.MARITAL_STATUS_EFFECTIVE_DATE,
5062 org_rec.minority_owned_ind,
5063 org_rec.minority_owned_type,
5064 org_rec.organization_type,
5065 web_rec.url,
5066 org_rec.oob_ind,
5067 person_rec.personal_income,
5068 person_rec.person_academic_title,
5069 person_rec.person_first_name_phonetic,
5070 person_rec.person_last_name_phonetic,
5071 person_rec.middle_name_phonetic,
5072 person_rec.person_name_phonetic,
5073 person_rec.person_previous_last_name, --modify ak
5074 person_rec.place_of_birth,
5075 org_rec.principal_name,
5076 org_rec.principal_title,
5077 org_rec.public_private_ownership_flag,
5078 person_rec.rent_own_ind,
5079 person_rec.person_academic_title,
5080 location_rec.short_description,
5081 org_rec.small_bus_ind,
5082 person_rec.tax_reference,
5083 org_rec.woman_owned_ind,
5084 org_rec.ATTRIBUTE1,
5085 org_rec.ATTRIBUTE2,
5086 org_rec.ATTRIBUTE3,
5087 org_rec.ATTRIBUTE4,
5088 org_rec.ATTRIBUTE5,
5089 org_rec.ATTRIBUTE6,
5090 org_rec.ATTRIBUTE7,
5091 org_rec.ATTRIBUTE8,
5092 org_rec.ATTRIBUTE9,
5093 org_rec.ATTRIBUTE10,
5094 org_rec.ATTRIBUTE11,
5095 org_rec.ATTRIBUTE12,
5096 org_rec.ATTRIBUTE13,
5097 org_rec.ATTRIBUTE14,
5098 org_rec.ATTRIBUTE15,
5099 person_rec.ATTRIBUTE1,
5100 person_rec.ATTRIBUTE2,
5101 person_rec.ATTRIBUTE3,
5102 person_rec.ATTRIBUTE4,
5103 person_rec.ATTRIBUTE5,
5104 person_rec.ATTRIBUTE6,
5105 person_rec.ATTRIBUTE7,
5106 person_rec.ATTRIBUTE8,
5107 person_rec.ATTRIBUTE9,
5108 person_rec.ATTRIBUTE10,
5109 person_rec.ATTRIBUTE11,
5110 person_rec.ATTRIBUTE12,
5111 person_rec.ATTRIBUTE13,
5112 person_rec.ATTRIBUTE14,
5113 person_rec.ATTRIBUTE15,
5114 ocon_rec.ATTRIBUTE1,
5115 ocon_rec.ATTRIBUTE2,
5116 ocon_rec.ATTRIBUTE3,
5117 ocon_rec.ATTRIBUTE4,
5118 ocon_rec.ATTRIBUTE5,
5119 ocon_rec.ATTRIBUTE6,
5120 ocon_rec.ATTRIBUTE7,
5121 ocon_rec.ATTRIBUTE8,
5122 ocon_rec.ATTRIBUTE9,
5123 ocon_rec.ATTRIBUTE10,
5124 ocon_rec.ATTRIBUTE11,
5125 ocon_rec.ATTRIBUTE12,
5126 ocon_rec.ATTRIBUTE13,
5127 ocon_rec.ATTRIBUTE14,
5128 ocon_rec.ATTRIBUTE15,
5129 location_rec.ATTRIBUTE1,
5130 location_rec.ATTRIBUTE2,
5131 location_rec.ATTRIBUTE3,
5132 location_rec.ATTRIBUTE4,
5133 location_rec.ATTRIBUTE5,
5134 location_rec.ATTRIBUTE6,
5135 location_rec.ATTRIBUTE7,
5136 location_rec.ATTRIBUTE8,
5137 location_rec.ATTRIBUTE9,
5138 location_rec.ATTRIBUTE10,
5139 location_rec.ATTRIBUTE11,
5140 location_rec.ATTRIBUTE12,
5141 location_rec.ATTRIBUTE13,
5142 location_rec.ATTRIBUTE14,
5143 location_rec.ATTRIBUTE15,
5144 fax_rec.phone_country_code,
5145 fax_rec.phone_area_code,
5146 fax_rec.phone_number,
5147 org_rec.attribute_category,
5148 person_rec.attribute_category,
5149 ocon_rec.attribute_category,
5150 location_rec.attribute_category,
5151 psiteuse_rec.site_use_type;
5152
5153
5154 if b2b%notfound then
5155 return;
5156 end if;
5157
5158 -- Update Organization
5159
5160 org_rec.party_rec.party_id := x_org_party_id;
5161 org_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
5162 org_rec.application_id := 530;
5163 -- SELECT last_update_date INTO l_last_update_date
5164 SELECT OBJECT_VERSION_NUMBER INTO l_object_version
5165 FROM hz_parties
5166 WHERE party_id= x_org_party_id;
5167 x_date1 := l_last_update_date;
5168 org_rec.party_rec.status := 'A';
5169 hz_party_v2pub.update_organization(
5170 'F',
5171 org_rec,
5172 l_object_version,
5173 x_profile_id,
5174 x_return_status,
5175 x_msg_count,
5176 x_msg_data);
5177 if x_msg_count > 1 then
5178 FOR i IN 1..x_msg_count LOOP
5179 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
5180 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
5181 END LOOP;
5182 x_msg_data := x_tmp_var1;
5183 END IF;
5184
5185 if x_return_status <> 'S' then
5186 p_return_status := x_return_status;
5187 p_msg_count := x_msg_count;
5188 p_msg_data := x_msg_data;
5189 ROLLBACK;
5190 RETURN;
5191 end if;
5192
5193 -- Update Person
5194
5195 SELECT subject_id into x_person_id FROM hz_relationships WHERE subject_type = 'PERSON'
5196 AND party_id = p_party_id;
5197 -- SELECT last_update_date INTO l_last_update_date1
5198 SELECT OBJECT_VERSION_NUMBER INTO l_object_version
5199 FROM HZ_PARTIES
5200 WHERE party_id = x_person_id;
5201 x_date1 := l_last_update_date1;
5202 person_rec.party_rec.party_id := x_person_id;
5203 person_rec.party_rec.status := 'A';
5204 person_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
5205 person_rec.application_id := 530;
5206 hz_party_v2pub.update_person(
5207 'F',
5208 person_rec,
5209 l_object_version,
5210 x_profile_id,
5211 x_return_status,
5212 x_msg_count,
5213 x_msg_data);
5214 if x_msg_count > 1 then
5215 FOR i IN 1..x_msg_count LOOP
5216 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
5217 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
5218 END LOOP;
5219 x_msg_data := x_tmp_var1;
5220 END IF;
5221
5222 if x_return_status <> 'S' then
5223 p_return_status := x_return_status;
5224 p_msg_count := x_msg_count;
5225 p_msg_data := x_msg_data;
5226 ROLLBACK;
5227 RETURN;
5228 end if;
5229
5230 -- Update Org Contacts
5231 open c_relationship;
5232 fetch c_relationship into x_relationship_id,l_object_version2;
5233 close c_relationship;
5234
5235 SELECT ORG_CONTACT_ID, OBJECT_VERSION_NUMBER into x_org_contact_id ,l_object_version3 FROM hz_org_contacts WHERE
5236 PARTY_RELATIONSHIP_ID = x_relationship_id;
5237
5238 select last_update_date into x_date_three from hz_parties where party_id = p_party_id;
5239 -- ocon_rec.status := 'A';
5240 ocon_rec.org_contact_id := x_org_contact_id;
5241 ocon_rec.party_rel_rec.status := 'A';
5242 ocon_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
5243 ocon_rec.application_id := 530;
5244 hz_party_contact_v2pub.update_org_contact(
5245 'F',
5246 ocon_rec,
5247 l_object_version,
5248 l_object_version2,
5249 l_object_version3,
5250 x_return_status,
5251 x_msg_count,
5252 x_msg_data);
5253 if x_msg_count > 1 then
5254 FOR i IN 1..x_msg_count LOOP
5255 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
5256 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
5257 END LOOP;
5258 x_msg_data := x_tmp_var1;
5259 END IF;
5260
5261 if x_return_status <> 'S' then
5262 p_return_status := x_return_status;
5263 p_msg_count := x_msg_count;
5264 p_msg_data := x_msg_data;
5265 ROLLBACK;
5266 RETURN;
5267 end if;
5268
5269
5270 -- Create Location
5271
5272 if x_hz_dup_check = 'Y' then
5273 address_echeck(
5274 p_party_id => x_org_party_id,
5275 x_return_status => x_return_status,
5276 x_msg_count => x_msg_count,
5277 x_msg_data => x_msg_data,
5278 p_location_id => x_locatiON_Id,
5279 p_address1 => location_rec.address1,
5280 p_city => location_rec.city,
5281 p_pcode => location_rec.postal_code,
5282 p_country => location_rec.country
5283 );
5284 if x_return_status <> 'S' then
5285 p_return_status := x_return_status;
5286 p_msg_count := x_msg_count;
5287 p_msg_data := x_msg_data;
5288 ROLLBACK;
5289 RETURN;
5290 end if;
5291
5292 end if;
5293
5294 if x_location_id is null and x_org_party_id is not null then
5295 if location_rec.address1 is not NULL then
5296 x_return_status := null;
5297 x_msg_count := null;
5298 x_msg_data := null;
5299
5300 create_location (
5301 location_rec ,
5302 x_return_status ,
5303 x_msg_count ,
5304 x_msg_data ,
5305 x_location_id );
5306 if x_return_status <> 'S' then
5307 rollback;
5308 return;
5309 end if;
5310 end if; -- if location_rec.address1 is not NULL
5311 end if; -- x_location_id is null;
5312
5313 -- Create Party Site
5314 l_lp_psite_id := null;
5315 open LOCATION_EXISTS;
5316 fetch LOCATION_EXISTS into l_lp_psite_id;
5317 close LOCATION_EXISTS;
5318 if l_lp_psite_id is null and x_org_party_id is not null and x_location_id is not null then
5319 psite_rec.party_id := x_org_party_id;
5320 psite_rec.location_id := x_location_id;
5321 psite_rec.status := 'A';
5322
5323 create_party_site(
5324 psite_rec,
5325 x_return_status,
5326 x_msg_count,
5327 x_msg_data,
5328 x_party_site_id,
5329 x_party_site_number
5330 );
5331 if x_return_status <> 'S' then
5332 rollback;
5333 return;
5334 end if;
5335 end if;
5336
5337 -- Creating party_site for Contacts.
5338 x_party_rel_party_id := p_party_id;
5339 if person_rec.person_first_name is not null and x_party_rel_party_id is not null then
5340 if location_rec.address1 is not NULL and x_location_id is not null then
5341 l_lp_psite_id := null;
5342 open CHECK_PSITE_EXISTS;
5343 fetch CHECK_PSITE_EXISTS into l_lp_psite_id;
5344 close CHECK_PSITE_EXISTS;
5345 if l_lp_psite_id is null then
5346 -- Create Party Site
5347 x_return_status := null;
5348 x_msg_count := null;
5349 x_msg_data := null;
5350 x_party_site_number := null;
5351
5352 psite_rec.party_id := x_party_rel_party_id;
5353 psite_rec.location_id := x_location_id;
5354 psite_rec.status := 'A';
5355 create_party_site(
5356 psite_rec,
5357 x_return_status,
5358 x_msg_count,
5359 x_msg_data,
5360 x_party_site_id,
5361 x_party_site_number
5362 );
5363 if x_return_status <> 'S' then
5364 rollback;
5365 return;
5366 end if;
5367 end if;
5368 end if;
5369 end if;
5370
5371 -- Create contact points Phone
5372
5373 if x_phone_number is not NULL and x_party_rel_party_id is not null then
5374
5375 x_return_status := null;
5376 x_msg_count := null;
5377 x_msg_data := null;
5378 cpoint_rec.contact_point_type := 'PHONE';
5379 cpoint_rec.status := 'A';
5380 cpoint_rec.owner_table_name := 'HZ_PARTIES';
5381 cpoint_rec.owner_table_id := x_party_rel_party_id;
5382 phone_rec.phone_line_type := 'GEN';
5383 phone_rec.phone_number := x_phone_number;
5384 phone_rec.phone_country_code := x_phone_country_code;
5385 phone_rec.phone_area_code := x_phone_area_code;
5386 phone_rec.phone_extension := x_phone_extention;
5387
5388 l_phone_exists := NULL;
5389 open phone_exists(x_party_rel_party_id);
5390 fetch phone_exists into l_phone_exists;
5391 close phone_exists;
5392 if l_phone_exists is NULL then
5393 create_contact_point(
5394 cpoint_rec,
5395 edi_rec,
5396 email_rec,
5397 phone_rec,
5398 telex_rec,
5399 web_rec,
5400 x_return_status,
5401 x_msg_count,
5402 x_msg_data,
5403 x_contact_point_id);
5404 if x_return_status <> 'S' then
5405 rollback;
5406 return;
5407 end if;
5408 end if;
5409 end if;
5410
5411 -- Create contact points Email
5412
5413 if x_email_address is not NULL and x_party_rel_party_id is not null then
5414
5415 x_return_status := null;
5416 x_msg_count := null;
5417 x_msg_data := null;
5418 cpoint_rec.contact_point_type := 'EMAIL';
5419 cpoint_rec.status := 'A';
5420 cpoint_rec.owner_table_name := 'HZ_PARTIES';
5421 cpoint_rec.owner_table_id := x_party_rel_party_id;
5422 email_rec.email_address := x_email_address;
5423 l_email_exists := NULL;
5424 open email_exists(x_party_rel_party_id);
5425 fetch email_exists into l_email_exists;
5426 close email_exists;
5427 if l_email_exists is NULL then
5428 create_contact_point(
5429 cpoint_rec,
5430 edi_rec,
5431 email_rec,
5432 phone_rec,
5433 telex_rec,
5434 web_rec,
5435 x_return_status,
5436 x_msg_count,
5437 x_msg_data,
5438 x_contact_point_id);
5439 if x_return_status <> 'S' then
5440 rollback;
5441 return;
5442 end if;
5443 end if;
5444 end if;
5445
5446 end if; -- b2b = 'Y'
5447
5448 if x_b2b = 'B2C' then
5449 OPEN b2c;
5450 FETCH b2c into
5451 person_rec.party_rec.orig_system_reference,
5452 person_rec.person_first_name,
5453 person_rec.person_middle_name,
5454 person_rec.person_last_name,
5455 person_rec.person_name_suffix,
5456 person_rec.person_pre_name_adjunct,
5457 -- person_rec.best_time_contact_begin,
5458 -- person_rec.best_time_contact_end,
5459 location_rec.country,
5460 location_rec.address1,
5461 location_rec.address2,
5462 location_rec.city,
5463 location_rec.county,
5464 location_rec.state,
5465 location_rec.province,
5466 location_rec.postal_code,
5467 -- location_rec.time_zone,
5468 x_email_address,
5469 x_phone_country_code,
5470 x_phone_area_code,
5471 x_phone_number,
5472 x_phone_extention,
5473 -- person_rec.person_pre_name_adjunct,
5474 person_rec.party_rec.SALUTATION,
5475 location_rec.ADDRESS3,
5476 location_rec.ADDRESS4,
5477 location_rec.ADDRESS_LINES_PHONETIC,
5478 -- location_rec.APARTMENT_FLAG,
5479 -- bug 4641591: columns obsolete
5480 -- location_rec.PO_BOX_NUMBER,
5481 -- location_rec.HOUSE_NUMBER,
5482 -- location_rec.STREET_SUFFIX,
5483 -- location_rec.SECONDARY_SUFFIX_ELEMENT,
5484 -- location_rec.STREET,
5485 -- location_rec.RURAL_ROUTE_TYPE,
5486 -- location_rec.RURAL_ROUTE_NUMBER,
5487 -- location_rec.STREET_NUMBER,
5488 -- location_rec.FLOOR,
5489 -- location_rec.SUITE,
5490 location_rec.POSTAL_PLUS4_CODE,
5491 -- location_rec.OVERSEAS_ADDRESS_FLAG,
5492 psite_rec.identifying_address_flag,
5493
5494 person_rec.person_last_name_phonetic,
5495 person_rec.person_first_name_phonetic,
5496 --PREFERRED_NAME,
5497 web_rec.url, -- replace PREFERRED_NAME with URL
5498 person_rec.person_academic_title,
5499 person_rec.date_of_birth,
5500 person_rec.person_academic_title,
5501 person_rec.person_previous_last_name,
5502 person_rec.known_as,
5503 person_rec.known_as2,
5504 person_rec.known_as3,
5505 person_rec.known_as4,
5506 person_rec.known_as5,
5507 person_rec.person_name_phonetic,
5508 person_rec.middle_name_phonetic,
5509 person_rec.jgzz_fiscal_code,
5510 person_rec.place_of_birth,
5511 person_rec.date_of_death,
5512 person_rec.declared_ethnicity,
5513 person_rec.marital_status,
5514 person_rec.personal_income,
5515 person_rec.marital_status_effective_date,
5516 person_rec.head_of_household_flag,
5517 person_rec.household_size,
5518 location_rec.location_directions,
5519 location_rec.address_effective_date,
5520 location_rec.address_expiration_date,
5521 person_rec.attribute1,
5522 person_rec.attribute2,
5523 person_rec.attribute3,
5524 person_rec.attribute4,
5525 person_rec.attribute5,
5526 person_rec.attribute6,
5527 person_rec.attribute7,
5528 person_rec.attribute8,
5529 person_rec.attribute9,
5530 person_rec.attribute10,
5531 person_rec.attribute11,
5532 person_rec.attribute12,
5533 person_rec.attribute13,
5534 person_rec.attribute14,
5535 person_rec.attribute15,
5536 location_rec.attribute1,
5537 location_rec.attribute2,
5538 location_rec.attribute3,
5539 location_rec.attribute4,
5540 location_rec.attribute5,
5541 location_rec.attribute6,
5542 location_rec.attribute7,
5543 location_rec.attribute8,
5544 location_rec.attribute9,
5545 location_rec.attribute10,
5546 location_rec.attribute11,
5547 location_rec.attribute12,
5548 location_rec.attribute13,
5549 location_rec.attribute14,
5550 location_rec.attribute15,
5551 fax_rec.phone_country_code,
5552 fax_rec.phone_area_code,
5553 fax_rec.phone_number,
5554 person_rec.attribute_category,
5555 location_rec.attribute_category ,
5556 location_rec.short_description,
5557 location_rec.description,
5558 psiteuse_rec.site_use_type;
5559 CLOSE b2c;
5560
5561 -- Update Person
5562
5563 -- SELECT last_update_date INTO l_last_update_date1
5564 l_object_version := NULL;
5565 SELECT OBJECT_VERSION_NUMBER INTO l_object_version
5566 FROM HZ_PARTIES
5567 WHERE party_id = p_party_id;
5568 x_date1 := l_last_update_date1;
5569 person_rec.party_rec.party_id := p_party_id;
5570 person_rec.party_rec.status := 'A';
5571 person_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
5572 person_rec.application_id := 530;
5573 hz_party_v2pub.update_person(
5574 'F',
5575 person_rec,
5576 l_object_version,
5577 x_profile_id,
5578 x_return_status,
5579 x_msg_count,
5580 x_msg_data);
5581 if x_msg_count > 1 then
5582 FOR i IN 1..x_msg_count LOOP
5583 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
5584 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
5585 END LOOP;
5586 x_msg_data := x_tmp_var1;
5587 END IF;
5588
5589 if x_return_status <> 'S' then
5590 p_return_status := x_return_status;
5591 p_msg_count := x_msg_count;
5592 p_msg_data := x_msg_data;
5593 ROLLBACK;
5594 RETURN;
5595 end if;
5596
5597 -- Create Location
5598 x_per_party_id := p_party_id;
5599 if x_hz_dup_check = 'Y' then
5600 address_echeck(
5601 p_party_id => x_per_party_id,
5602 x_return_status => x_return_status,
5603 x_msg_count => x_msg_count,
5604 x_msg_data => x_msg_data,
5605 p_location_id => x_locatiON_Id,
5606 p_address1 => location_rec.address1,
5607 p_city => location_rec.city,
5608 p_pcode => location_rec.postal_code,
5609 p_country => location_rec.country
5610 );
5611 if x_return_status <> 'S' then
5612 p_return_status := x_return_status;
5613 p_msg_count := x_msg_count;
5614 p_msg_data := x_msg_data;
5615 ROLLBACK;
5616 RETURN;
5617 end if;
5618
5619 end if;
5620
5621 if x_location_id is null and x_per_party_id is not null then
5622 if location_rec.address1 is not NULL then
5623 x_return_status := null;
5624 x_msg_count := null;
5625 x_msg_data := null;
5626
5627 create_location (
5628 location_rec ,
5629 x_return_status ,
5630 x_msg_count ,
5631 x_msg_data ,
5632 x_location_id );
5633 if x_return_status <> 'S' then
5634 rollback;
5635 return;
5636 end if;
5637 end if; -- if location_rec.address1 is not NULL
5638 end if; -- x_location_id is null;
5639
5640
5641 l_lp_psite_id := null;
5642 open PER_LOCATION_EXISTS;
5643 fetch PER_LOCATION_EXISTS into l_lp_psite_id;
5644 close PER_LOCATION_EXISTS;
5645 if l_lp_psite_id is null and x_per_party_id is not null and x_location_id is not null then
5646 -- Create Party Site
5647 x_return_status := null;
5648 x_msg_count := null;
5649 x_msg_data := null;
5650 x_party_site_number := null;
5651 psite_rec.party_id := x_per_party_id;
5652 psite_rec.location_id := x_location_id;
5653 psite_rec.status := 'A';
5654
5655 create_party_site(
5656 psite_rec,
5657 x_return_status,
5658 x_msg_count,
5659 x_msg_data,
5660 x_party_site_id,
5661 x_party_site_number
5662 );
5663 if x_return_status <> 'S' then
5664 rollback;
5665 return;
5666 end if;
5667 end if;
5668
5669
5670 -- Create contact points Phone
5671
5672 if x_phone_number is not NULL and x_per_party_id is not null then
5673
5674 x_return_status := null;
5675 x_msg_count := null;
5676 x_msg_data := null;
5677 cpoint_rec.contact_point_type := 'PHONE';
5678 cpoint_rec.status := 'A';
5679 cpoint_rec.owner_table_name := 'HZ_PARTIES';
5680 cpoint_rec.owner_table_id := x_per_party_id;
5681 phone_rec.phone_line_type := 'GEN';
5682 phone_rec.phone_number := x_phone_number;
5683 phone_rec.phone_country_code := x_phone_country_code;
5684 phone_rec.phone_area_code := x_phone_area_code;
5685 phone_rec.phone_extension := x_phone_extention;
5686
5687 l_phone_exists := NULL;
5688 open phone_exists(x_per_party_id);
5689 fetch phone_exists into l_phone_exists;
5690 close phone_exists;
5691 if l_phone_exists is NULL then
5692 create_contact_point(
5693 cpoint_rec,
5694 edi_rec,
5695 email_rec,
5696 phone_rec,
5697 telex_rec,
5698 web_rec,
5699 x_return_status,
5700 x_msg_count,
5701 x_msg_data,
5702 x_contact_point_id);
5703 if x_return_status <> 'S' then
5704 rollback;
5705 return;
5706 end if;
5707 end if;
5708 end if;
5709
5710
5711 -- Create contact points Email
5712
5713 if x_email_address is not NULL and x_per_party_id is not null then
5714
5715 x_return_status := null;
5716 x_msg_count := null;
5717 x_msg_data := null;
5718 cpoint_rec.contact_point_type := 'EMAIL';
5719 cpoint_rec.status := 'A';
5720 cpoint_rec.owner_table_name := 'HZ_PARTIES';
5721 cpoint_rec.owner_table_id := x_per_party_id;
5722 email_rec.email_address := x_email_address;
5723 l_email_exists := NULL;
5724 open email_exists(x_per_party_id);
5725 fetch email_exists into l_email_exists;
5726 close email_exists;
5727 if l_email_exists is NULL then
5728 create_contact_point(
5729 cpoint_rec,
5730 edi_rec,
5731 email_rec,
5732 phone_rec,
5733 telex_rec,
5734 web_rec,
5735 x_return_status,
5736 x_msg_count,
5737 x_msg_data,
5738 x_contact_point_id);
5739 if x_return_status <> 'S' then
5740 rollback;
5741 return;
5742 end if;
5743 end if;
5744 end if;
5745
5746 end if; -- if x_b2b = 'N' then
5747 end update_rented_list_party;
5748
5749 -- -------------------------------------------------------------
5750
5751 -- This program performs error checks in ams_import_interface table.
5752
5753 PROCEDURE execute_lead_data_validation (
5754 p_import_list_header_id NUMBER,
5755 p_return_status OUT NOCOPY VARCHAR2
5756 ) IS
5757
5758 TYPE num_data_set_type_w IS
5759 TABLE OF NUMBER INDEX BY BINARY_INTEGER;
5760
5761 TYPE varchar2_250_set_type IS
5762 TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
5763
5764 L_MAX_ROW_COUNT CONSTANT NUMBER := 1000;
5765 l_batch_id NUMBER;
5766 l_assign_date varchar2(150);
5767 l_lead_date varchar2(150);
5768 l_address_effective_date varchar2(150);
5769 l_last_ordered_date varchar2(150);
5770 l_program_update_date varchar2(150);
5771 x_import_list_header_id number;
5772 x_import_source_line_id number;
5773 l_message varchar2(100);
5774 l_invalid_number varchar2(4000) ;
5775 l_invalid_size varchar2(4000) ;
5776 l_null_value varchar2(4000) ;
5777 l_invalid_src_system varchar2(4000) ;
5778 l_return_status varchar2(1);
5779 l_total_rec number;
5780 l_source_system varchar2(60);
5781 l_error_exists varchar2(1);
5782
5783
5784
5785 l_import_source_line_id num_data_set_type_w;
5786 l_import_list_header_id num_data_set_type_w;
5787
5788 l_col1 varchar2_250_set_type;
5789 l_col2 varchar2_250_set_type;
5790 l_col3 varchar2_250_set_type;
5791 l_col4 varchar2_250_set_type;
5792 l_col5 varchar2_250_set_type;
5793 l_col6 varchar2_250_set_type;
5794 l_col7 varchar2_250_set_type;
5795 l_col8 varchar2_250_set_type;
5796 l_col9 varchar2_250_set_type;
5797 l_col10 varchar2_250_set_type;
5798 l_col11 varchar2_250_set_type;
5799 l_col12 varchar2_250_set_type;
5800 l_col13 varchar2_250_set_type;
5801 l_col14 varchar2_250_set_type;
5802 l_col15 varchar2_250_set_type;
5803 l_col16 varchar2_250_set_type;
5804 l_col17 varchar2_250_set_type;
5805 l_col18 varchar2_250_set_type;
5806 l_col19 varchar2_250_set_type;
5807 l_col20 varchar2_250_set_type;
5808 l_col21 varchar2_250_set_type;
5809 l_col22 varchar2_250_set_type;
5810 l_col23 varchar2_250_set_type;
5811 l_col24 varchar2_250_set_type;
5812 l_col25 varchar2_250_set_type;
5813 l_col26 varchar2_250_set_type;
5814 l_col27 varchar2_250_set_type;
5815 l_col28 varchar2_250_set_type;
5816 l_col29 varchar2_250_set_type;
5817 l_col30 varchar2_250_set_type;
5818 l_col31 varchar2_250_set_type;
5819 l_col32 varchar2_250_set_type;
5820 l_col33 varchar2_250_set_type;
5821 l_col34 varchar2_250_set_type;
5822 l_col35 varchar2_250_set_type;
5823 l_col36 varchar2_250_set_type;
5824 l_col37 varchar2_250_set_type;
5825 l_col38 varchar2_250_set_type;
5826 l_col39 varchar2_250_set_type;
5827 l_col40 varchar2_250_set_type;
5828 l_col41 varchar2_250_set_type;
5829 l_col42 varchar2_250_set_type;
5830 l_col43 varchar2_250_set_type;
5831 l_col44 varchar2_250_set_type;
5832 l_col45 varchar2_250_set_type;
5833 l_col46 varchar2_250_set_type;
5834 l_col47 varchar2_250_set_type;
5835 l_col48 varchar2_250_set_type;
5836 l_col49 varchar2_250_set_type;
5837 l_col50 varchar2_250_set_type;
5838 l_col51 varchar2_250_set_type;
5839 l_col52 varchar2_250_set_type;
5840 l_col53 varchar2_250_set_type;
5841 l_col54 varchar2_250_set_type;
5842 l_col55 varchar2_250_set_type;
5843 l_col56 varchar2_250_set_type;
5844 l_col57 varchar2_250_set_type;
5845 l_col58 varchar2_250_set_type;
5846 l_col59 varchar2_250_set_type;
5847 l_col60 varchar2_250_set_type;
5848 l_col61 varchar2_250_set_type;
5849 l_col62 varchar2_250_set_type;
5850 l_col63 varchar2_250_set_type;
5851 l_col64 varchar2_250_set_type;
5852 l_col65 varchar2_250_set_type;
5853 l_col66 varchar2_250_set_type;
5854 l_col67 varchar2_250_set_type;
5855 l_col68 varchar2_250_set_type;
5856 l_col69 varchar2_250_set_type;
5857 l_col70 varchar2_250_set_type;
5858 l_col71 varchar2_250_set_type;
5859 l_col72 varchar2_250_set_type;
5860 l_col73 varchar2_250_set_type;
5861 l_col74 varchar2_250_set_type;
5862 l_col75 varchar2_250_set_type;
5863 l_col76 varchar2_250_set_type;
5864 l_col77 varchar2_250_set_type;
5865 l_col78 varchar2_250_set_type;
5866 l_col79 varchar2_250_set_type;
5867 l_col80 varchar2_250_set_type;
5868 l_col81 varchar2_250_set_type;
5869 l_col82 varchar2_250_set_type;
5870 l_col83 varchar2_250_set_type;
5871 l_col84 varchar2_250_set_type;
5872 l_col85 varchar2_250_set_type;
5873 l_col86 varchar2_250_set_type;
5874 l_col87 varchar2_250_set_type;
5875 l_col88 varchar2_250_set_type;
5876 l_col89 varchar2_250_set_type;
5877 l_col90 varchar2_250_set_type;
5878 l_col91 varchar2_250_set_type;
5879 l_col92 varchar2_250_set_type;
5880 l_col93 varchar2_250_set_type;
5881 l_col94 varchar2_250_set_type;
5882 l_col95 varchar2_250_set_type;
5883 l_col96 varchar2_250_set_type;
5884 l_col97 varchar2_250_set_type;
5885 l_col98 varchar2_250_set_type;
5886 l_col99 varchar2_250_set_type;
5887 l_col100 varchar2_250_set_type;
5888 l_col101 varchar2_250_set_type;
5889 l_col102 varchar2_250_set_type;
5890 l_col103 varchar2_250_set_type;
5891 l_col104 varchar2_250_set_type;
5892 l_col105 varchar2_250_set_type;
5893 l_col106 varchar2_250_set_type;
5894 l_col107 varchar2_250_set_type;
5895 l_col108 varchar2_250_set_type;
5896 l_col109 varchar2_250_set_type;
5897 l_col110 varchar2_250_set_type;
5898 l_col111 varchar2_250_set_type;
5899 l_col112 varchar2_250_set_type;
5900 l_col113 varchar2_250_set_type;
5901 l_col114 varchar2_250_set_type;
5902 l_col115 varchar2_250_set_type;
5903 l_col116 varchar2_250_set_type;
5904 l_col117 varchar2_250_set_type;
5905 l_col118 varchar2_250_set_type;
5906 l_col119 varchar2_250_set_type;
5907 l_col120 varchar2_250_set_type;
5908 l_col121 varchar2_250_set_type;
5909 l_col122 varchar2_250_set_type;
5910 l_col123 varchar2_250_set_type;
5911 l_col124 varchar2_250_set_type;
5912 l_col125 varchar2_250_set_type;
5913 l_col126 varchar2_250_set_type;
5914 l_col127 varchar2_250_set_type;
5915 l_col128 varchar2_250_set_type;
5916 l_col129 varchar2_250_set_type;
5917 l_col130 varchar2_250_set_type;
5918 l_col131 varchar2_250_set_type;
5919 l_col132 varchar2_250_set_type;
5920 l_col133 varchar2_250_set_type;
5921 l_col134 varchar2_250_set_type;
5922 l_col135 varchar2_250_set_type;
5923 l_col136 varchar2_250_set_type;
5924 l_col137 varchar2_250_set_type;
5925 l_col138 varchar2_250_set_type;
5926 l_col139 varchar2_250_set_type;
5927 l_col140 varchar2_250_set_type;
5928 l_col141 varchar2_250_set_type;
5929 l_col142 varchar2_250_set_type;
5930 l_col143 varchar2_250_set_type;
5931 l_col144 varchar2_250_set_type;
5932 l_col145 varchar2_250_set_type;
5933 l_col146 varchar2_250_set_type;
5934 l_col147 varchar2_250_set_type;
5935 l_col148 varchar2_250_set_type;
5936 l_col149 varchar2_250_set_type;
5937 l_col150 varchar2_250_set_type;
5938 l_col151 varchar2_250_set_type;
5939 l_col152 varchar2_250_set_type;
5940 l_col153 varchar2_250_set_type;
5941 l_col154 varchar2_250_set_type;
5942 l_col155 varchar2_250_set_type;
5943 l_col156 varchar2_250_set_type;
5944 l_col157 varchar2_250_set_type;
5945 l_col158 varchar2_250_set_type;
5946 l_col159 varchar2_250_set_type;
5947 l_col160 varchar2_250_set_type;
5948 l_col161 varchar2_250_set_type;
5949 l_col162 varchar2_250_set_type;
5950 l_col163 varchar2_250_set_type;
5951 l_col164 varchar2_250_set_type;
5952 l_col165 varchar2_250_set_type;
5953 l_col166 varchar2_250_set_type;
5954 l_col167 varchar2_250_set_type;
5955 l_col168 varchar2_250_set_type;
5956 l_col169 varchar2_250_set_type;
5957 l_col170 varchar2_250_set_type;
5958 l_col171 varchar2_250_set_type;
5959 l_col172 varchar2_250_set_type;
5960 l_col173 varchar2_250_set_type;
5961 l_col174 varchar2_250_set_type;
5962 l_col175 varchar2_250_set_type;
5963 l_col176 varchar2_250_set_type;
5964 l_col177 varchar2_250_set_type;
5965 l_col178 varchar2_250_set_type;
5966 l_col179 varchar2_250_set_type;
5967 l_col180 varchar2_250_set_type;
5968 l_col181 varchar2_250_set_type;
5969 l_col182 varchar2_250_set_type;
5970 l_col183 varchar2_250_set_type;
5971 l_col184 varchar2_250_set_type;
5972 l_col185 varchar2_250_set_type;
5973 l_col186 varchar2_250_set_type;
5974 l_col187 varchar2_250_set_type;
5975 l_col188 varchar2_250_set_type;
5976 l_col189 varchar2_250_set_type;
5977 l_col190 varchar2_250_set_type;
5978 l_col191 varchar2_250_set_type;
5979 l_col192 varchar2_250_set_type;
5980 l_col193 varchar2_250_set_type;
5981 l_col194 varchar2_250_set_type;
5982 l_col195 varchar2_250_set_type;
5983 l_col196 varchar2_250_set_type;
5984 l_col197 varchar2_250_set_type;
5985 l_col198 varchar2_250_set_type;
5986 l_col199 varchar2_250_set_type;
5987 l_col200 varchar2_250_set_type;
5988 l_col201 varchar2_250_set_type;
5989 l_col202 varchar2_250_set_type;
5990 l_col203 varchar2_250_set_type;
5991 l_col204 varchar2_250_set_type;
5992 l_col205 varchar2_250_set_type;
5993 l_col206 varchar2_250_set_type;
5994 l_col207 varchar2_250_set_type;
5995 l_col208 varchar2_250_set_type;
5996 l_col209 varchar2_250_set_type;
5997 l_col210 varchar2_250_set_type;
5998 l_col211 varchar2_250_set_type;
5999 l_col212 varchar2_250_set_type;
6000 l_col213 varchar2_250_set_type;
6001 l_col214 varchar2_250_set_type;
6002 l_col215 varchar2_250_set_type;
6003 l_col216 varchar2_250_set_type;
6004 l_col217 varchar2_250_set_type;
6005 l_col218 varchar2_250_set_type;
6006 l_col219 varchar2_250_set_type;
6007 l_col220 varchar2_250_set_type;
6008 l_col221 varchar2_250_set_type;
6009 l_col222 varchar2_250_set_type;
6010 l_col223 varchar2_250_set_type;
6011 l_col224 varchar2_250_set_type;
6012 l_col225 varchar2_250_set_type;
6013 l_col226 varchar2_250_set_type;
6014 l_col227 varchar2_250_set_type;
6015 l_col228 varchar2_250_set_type;
6016
6017
6018 l_col229 varchar2_250_set_type;
6019 l_col230 varchar2_250_set_type;
6020 l_col231 varchar2_250_set_type;
6021 l_col232 varchar2_250_set_type;
6022 l_col233 varchar2_250_set_type;
6023 l_col234 varchar2_250_set_type;
6024 l_col235 varchar2_250_set_type;
6025 l_col236 varchar2_250_set_type;
6026 l_col237 varchar2_250_set_type;
6027 l_col238 varchar2_250_set_type;
6028
6029
6030
6031 CURSOR c_lead_fields is
6032 SELECT
6033 import_source_line_id,
6034 import_list_header_id,
6035 DECODE(GREATEST(lengthb(LTRIM(RTRIM(source_system))),30) - 30,0,' ','SOURCE_SYSTEM :'||decode(nvl(source_system,'x'),'x',l_null_value,l_invalid_size)||'(30)') source_system,
6036 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LEAD_NOTE)),'x')),2000) - 2000,0,' ','LEAD_NOTE :'||l_invalid_size||'(2000)') LEAD_NOTE,
6037 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROMOTION_CODE)),'x')),50) - 50,0,' ','PROMOTION_CODE :'||l_invalid_size||'(50)') PROMOTION_CODE,
6038 DECODE(GREATEST(lengthb(LTRIM(RTRIM(CUSTOMER_NAME))),255) - 255,0,' ','CUSTOMER_NAME :'||l_invalid_size||'(255)') CUSTOMER_NAME,
6039 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE)),'x')),30) - 30,0,' ','SIC_CODE :'||l_invalid_size||'(30)') SIC_CODE,
6040 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ANALYSIS_FY)),'x')),5) - 5,0,' ','ANALYSIS_FY :'||l_invalid_size||'(5)') ANALYSIS_FY,
6041 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CUSTOMER_CATEGORY_CODE)),'x')),30) -30,0,' ','CUSTOMER_CATEGORY_CODE:'||l_invalid_size||'(30)') CUSTOMER_CATEGORY_CODE,
6042 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FISCAL_YEAREND_MONTH)),'x')),30) - 30,0,' ','FISCAL_YEAREND_MONTH :'||l_invalid_size||'(30)') FISCAL_YEAREND_MONTH,
6043 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(num_of_employees,' ','x'))),'0123456789.',' x'))),0),0,' ','NUM_OF_EMPLOYEES :'||l_invalid_number) NUM_OF_EMPLOYE,
6044 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(POTENTIAL_REVENUE_CURR_FY,' ','x'))),'0123456789.',' x'))),0),0,' ','POTENTIAL_REVENUE_CURR_FY :'||l_invalid_number) POTENTIAL_REVENUE_CURR_FY,
6045 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(POTENTIAL_REVENUE_NEXT_FY,' ','x'))),'0123456789.',' x'))),0),0,' ','POTENTIAL_REVENUE_NEXT_FY :'||l_invalid_number) POTENTIAL_REVENUE_CURR_FY,
6046 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CUSTOMER_RANK)),'x')),30) - 30,0,' ','CUSTOMER_RANK :'||l_invalid_size||'(30)') CUSTOMER_RANK,
6047 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),50) - 50,0,' ','TAX_REFERENCE :'||l_invalid_size||'(50)') TAX_REFERENCE,
6048 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(YEAR_ESTABLISHED,' ','x'))),'0123456789.',' x'))),0),0,' ','YEAR_ESTABLISHED :'||l_invalid_number) YEAR_ESTABLISHED,
6049 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDR_DO_NOT_MAIL_FLAG)),'x')),1) - 1,0,' ','ADDR_DO_NOT_MAIL_FLAG :'||l_invalid_size||'(1)') ADDR_DO_NOT_MAIL_FLAG,
6050 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URL)),'x')),2000) - 2000,0,' ','URL :'||l_invalid_size) URL,
6051 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONT_DO_NOT_MAIL_FLAG)),'x')),1) - 1,0,' ','CONT_DO_NOT_MAIL_FLAG :'||l_invalid_size||'(1)') CONT_DO_NOT_MAIL_FLAG,
6052 DECODE(GREATEST(lengthb(LTRIM(RTRIM(COUNTRY))),60) - 60,0,' ','COUNTRY :'||decode(nvl(COUNTRY,'x'),'x',l_null_value,l_invalid_size)||'(60)') COUNTRY,
6053 DECODE(GREATEST(lengthb(LTRIM(RTRIM(ADDRESS1))),240) - 240,0,' ','ADDRESS1 :'||decode(nvl(ADDRESS1,'x'),'x',l_null_value,l_invalid_size)||'(240)') ADDRESS1,
6054 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,' ','ADDRESS2 :'||l_invalid_size||'(240)') ADDRESS2,
6055 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,' ','ADDRESS3 :'||l_invalid_size||'(240)') ADDRESS3,
6056 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,' ','ADDRESS4 :'||l_invalid_size||'(240)') ADDRESS4,
6057 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,' ','CITY :'||l_invalid_size||'(60)') CITY ,
6058 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,' ','POSTAL_CODE :'||l_invalid_size||'(60)') POSTAL_CODE,
6059 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,' ','STATE :'||l_invalid_size||'(60)') STATE,
6060 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,' ','PROVINCE :'||l_invalid_size||'(60)') PROVINCE,
6061 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,' ','COUNTY :'||l_invalid_size||'(60)') COUNTY,
6062 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,' ','EMAIL_ADDRESS :'||l_invalid_size||'(240)') EMAIL_ADDRESS,
6063 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SEX_CODE)),'x')),30) - 30,0,' ','SEX_CODE :'||l_invalid_size||'(30)') SEX_CODE,
6064 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALUTATION)),'x')),60) - 60,0,' ','SALUTATION :'||l_invalid_size||'(60)') SALUTATION,
6065 DECODE(GREATEST(lengthb(LTRIM(RTRIM(LAST_NAME))),50) - 50,0,' ','LAST_NAME :'||decode(nvl(LAST_NAME,'x'),'x',l_null_value,l_invalid_size)||'(50)') LAST_NAME,
6066 DECODE(GREATEST(lengthb(LTRIM(RTRIM(FIRST_NAME))),40) - 40,0,' ','FIRST_NAME :'||decode(nvl(FIRST_NAME,'x'),'x',l_null_value,l_invalid_size)||'(40)') FIRST_NAME,
6067 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TITLE)),'x')),40) - 40,0,' ','TITLE :'||l_invalid_size||'(40)') TITLE,
6068 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE)),'x')),100) - 100,0,' ','JOB_TITLE :'||l_invalid_size||'(100)') JOB_TITLE,
6069 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,' ','PHONE_NUMBER :'||l_invalid_size||'(25)') PHONE_NUMBER,
6070 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_STATUS)),'x')),1) - 1,0,' ','PHONE_STATUS :'||l_invalid_size||'(1)') PHONE_STATUS,
6071 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_TYPE)),'x')),30) - 30,0,' ','PHONE_TYPE :'||l_invalid_size||'(30)') PHONE_TYPE,
6072 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(AREA_CODE)),'x')),10) - 10,0,' ','AREA_CODE :'||l_invalid_size||'(10)') AREA_CODE,
6073 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EXTENSION)),'x')),20) - 20,0,' ','EXTENSION :'||l_invalid_size||'(20)') EXTENSION,
6074 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_INITIAL)),'x')),10) - 10,0,' ','MIDDLE_INITIAL :'||l_invalid_size||'(10)') MIDDLE_INITIAL,
6075 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE_CODE)),'x')),30) - 30,0,' ','JOB_TITLE_CODE :'||l_invalid_size||'(30)') JOB_TITLE_CODE,
6076 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MAIL_STOP)),'x')),60) - 60,0,' ','MAIL_STOP :'||l_invalid_size||'(60)') MAIL_STOP,
6077 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),25) - 25,0,' ','FAX_NUMBER:'||l_invalid_size||'(25)') FAX_NUMBER,
6078 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,' ','FAX_AREA_CODE :'||l_invalid_size||'(1)') FAX_AREA_CODE,
6079 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DO_NOT_PHONE_FLAG)),'x')),1) - 1,0,' ','DO_NOT_PHONE_FLAG :'||l_invalid_size||'(1)') DO_NOT_PHONE_FLAG,
6080 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DO_NOT_FAX_FLAG)),'x')),1) - 1,0,' ','DO_NOT_FAX_FLAG :'||l_invalid_size||'(1)') DO_NOT_FAX_FLAG,
6081 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DO_NOT_EMAIL_FLAG)),'x')),1) - 1,0,' ','DO_NOT_EMAIL_FLAG :'||l_invalid_size||'(1)') DO_NOT_EMAIL_FLAG,
6082 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URGENT_FLAG)),'x')),1) - 1,0,' ','URGENT_FLAG :'||l_invalid_size||'(1)') URGENT_FLAG,
6083 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ACCEPT_FLAG)),'x')),1) - 1,0,' ','ACCEPT_FLAG :'||l_invalid_size||'(1)') ACCEPT_FLAG,
6084 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DELETED_FLAG)),'x')),1) - 1,0,' ','DELETED_FLAG :'||l_invalid_size||'(1)') DELETED_FLAG,
6085 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(IMPORT_FLAG)),'x')),1) - 1,0,' ','IMPORT_FLAG :'||l_invalid_size||'(1)') IMPORT_FLAG,
6086 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KEEP_FLAG)),'x')),1) - 1,0,' ','KEEP_FLAG :'||l_invalid_size||'(1)') KEEP_FLAG,
6087 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(QUALIFIED_FLAG)),'x')),1) - 1,0,' ','QUALIFIED_FLAG :'||l_invalid_size||'(1)') QUALIFIED_FLAG,
6088 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRIMARY_CONTACT_FLAG)),'x')),1) - 1,0,' ','PRIMARY_CONTACT_FLAG :'||l_invalid_size||'(1)') PRIMARY_CONTACT_FLAG,
6089 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOC_VALIDATED_FLAG)),'x')),1) - 1,0,' ','LOC_VALIDATED_FLAG :'||l_invalid_size||'(1)') LOC_VALIDATED_FLAG,
6090 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GSA_INDICATOR_FLAG)),'x')),1) - 1,0,' ','GSA_INDICATOR_FLAG :'||l_invalid_size||'(1)') GSA_INDICATOR_FLAG,
6091 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_REFERENCE_USE_FLAG)),'x')),1) - 1,0,' ','PARTY_REFERENCE_USE_FLAG :'||l_invalid_size||'(1)') PARTY_REFERENCE_USE_FLAG,
6092 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTIES_VALIDATED_FLAG)),'x')),1) - 1,0,' ','PARTIES_VALIDATED_FLAG:'||l_invalid_size||'(1)') PARTIES_VALIDATED_FLAG,
6093 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,' ','DECISION_MAKER_FLAG :'||l_invalid_size||'(1)') DECISION_MAKER_FLAG,
6094 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_EXEC_SPONSOR_FLAG)),'x')),1) - 1,0,' ','PRM_EXEC_SPONSOR_FLAG :'||l_invalid_size||'(1)') PRM_EXEC_SPONSOR_FLAG,
6095 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_PRJ_LEAD_IN_PLACE_FLAG)),'x')),1) - 1,0,' ','PRM_PRJ_LEAD_IN_PLACE_FLAG :'||l_invalid_size||'(1)') PRM_PRJ_LEAD_IN_PLACE_FLAG,
6096 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_PARTY_FLAG)),'x')),1) - 1,0,' ','NEW_PARTY_FLAG :'||l_invalid_size||'(1)') NEW_PARTY_FLAG,
6097 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,' ','DECISION_MAKER_FLAG :'||l_invalid_size||'(1)') NEW_LOC_FLAG,
6098 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_PS_FLAG)),'x')),1) - 1,0,' ','NEW_PS_FLAG :'||l_invalid_size||'(1)') NEW_PS_FLAG,
6099 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_REL_FLAG)),'x')),1) - 1,0,' ','NEW_REL_FLAG :'||l_invalid_size||'(1)') NEW_REL_FLAG,
6100 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_CON_FLAG)),'x')),1) - 1,0,' ','NEW_CON_FLAG :'||l_invalid_size||'(1)') NEW_CON_FLAG,
6101 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTACT_ROLE_CODE)),'x')),30) - 30,0,' ','CONTACT_ROLE_CODE :'||l_invalid_size||'(30)') CONTACT_ROLE_CODE,
6102 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CHANNEL_CODE)),'x')),30) - 30,0,' ','CHANNEL_CODE :'||l_invalid_size||'(30)') CHANNEL_CODE,
6103 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUDGET_STATUS_CODE)),'x')),30) - 30,0,' ','BUDGET_STATUS_CODE :'||l_invalid_size||'(30)') BUDGET_STATUS_CODE,
6104 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_TIMEFRAME_CODE)),'x')),30) - 30,0,' ','DECISION_TIMEFRAME_CODE :'||l_invalid_size||'(30)') DECISION_TIMEFRAME_CODE,
6105 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CURRENCY_CODE)),'x')),15) - 15,0,' ','CURRENCY_CODE :'||l_invalid_size||'(15)') CURRENCY_CODE,
6106 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,' ','VEHICLE_RESPONSE_CODE :'||l_invalid_size||'(30)') VEHICLE_RESPONSE_CODE,
6107 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_1)),'x')),3) - 3,0,' ','UOM_CODE_1 :'||l_invalid_size||'(3)') UOM_CODE_1,
6108 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_2)),'x')),3) - 3,0,' ','UOM_CODE_2 :'||l_invalid_size||'(3)') UOM_CODE_2,
6109 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_3)),'x')),3) - 3,0,' ','UOM_CODE_3 :'||l_invalid_size||'(3)') UOM_CODE_3,
6110 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_4)),'x')),3) - 3,0,' ','UOM_CODE_4 :'||l_invalid_size||'(3)') UOM_CODE_4,
6111 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_5)),'x')),3) - 3,0,' ','UOM_CODE_5 :'||l_invalid_size||'(3)') UOM_CODE_5,
6112 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS)),'x')),240) - 240,0,' ','KNOWN_AS :'||l_invalid_size||'(3)') KNOWN_AS,
6113 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS2)),'x')),240) - 240,0,' ','KNOWN_AS2 :'||l_invalid_size||'(240)') KNOWN_AS2,
6114 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS3)),'x')),240) - 240,0,' ','KNOWN_AS3 :'||l_invalid_size||'(240)') KNOWN_AS3,
6115 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS4)),'x')),240) - 240,0,' ','KNOWN_AS4 :'||l_invalid_size||'(240)') KNOWN_AS4,
6116 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS5)),'x')),240) - 240,0,' ','KNOWN_AS5 :'||l_invalid_size||'(240)') KNOWN_AS5,
6117 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','INTEREST_TYPE_ID_1 :'||l_invalid_number) INTEREST_TYPE_ID_1,
6118 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','INTEREST_TYPE_ID_2 :'||l_invalid_number) INTEREST_TYPE_ID_2,
6119 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','INTEREST_TYPE_ID_3 :'||l_invalid_number) INTEREST_TYPE_ID_3,
6120 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','INTEREST_TYPE_ID_4 :'||l_invalid_number) INTEREST_TYPE_ID_4,
6121 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','INTEREST_TYPE_ID_5 :'||l_invalid_number) INTEREST_TYPE_ID_5,
6122 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','PRIMARY_INTEREST_CODE_ID_1 :'||l_invalid_number) PRIMARY_INTEREST_CODE_ID_1,
6123 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','PRIMARY_INTEREST_CODE_ID_2 :'||l_invalid_number) PRIMARY_INTEREST_CODE_ID_2,
6124 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','PRIMARY_INTEREST_CODE_ID_3 :'||l_invalid_number) PRIMARY_INTEREST_CODE_ID_3,
6125 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','PRIMARY_INTEREST_CODE_ID_4 :'||l_invalid_number) PRIMARY_INTEREST_CODE_ID_4,
6126 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','PRIMARY_INTEREST_CODE_ID_5 :'||l_invalid_number) PRIMARY_INTEREST_CODE_ID_5,
6127 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','SECONDARY_INTEREST_CODE_ID_1 :'||l_invalid_number) SECONDARY_INTEREST_CODE_ID_1,
6128 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','SECONDARY_INTEREST_CODE_ID_2 :'||l_invalid_number) SECONDARY_INTEREST_CODE_ID_2,
6129 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','SECONDARY_INTEREST_CODE_ID_3 :'||l_invalid_number) SECONDARY_INTEREST_CODE_ID_3,
6130 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','SECONDARY_INTEREST_CODE_ID_4 :'||l_invalid_number) SECONDARY_INTEREST_CODE_ID_4,
6131 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','SECONDARY_INTEREST_CODE_ID_5 :'||l_invalid_number) SECONDARY_INTEREST_CODE_ID_5,
6132 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','INVENTORY_ITEM_ID_1 :'||l_invalid_number) INVENTORY_ITEM_ID_1,
6133 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','INVENTORY_ITEM_ID_2 :'||l_invalid_number) INVENTORY_ITEM_ID_2,
6134 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','INVENTORY_ITEM_ID_3 :'||l_invalid_number) INVENTORY_ITEM_ID_3,
6135 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','INVENTORY_ITEM_ID_4 :'||l_invalid_number) INVENTORY_ITEM_ID_4,
6136 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','INVENTORY_ITEM_ID_5 :'||l_invalid_number) INVENTORY_ITEM_ID_5,
6137 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','ORGANIZATION_ID_1 :'||l_invalid_number) ORGANIZATION_ID_1,
6138 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','ORGANIZATION_ID_2 :'||l_invalid_number) ORGANIZATION_ID_2,
6139 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','ORGANIZATION_ID_3 :'||l_invalid_number) ORGANIZATION_ID_3,
6140 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','ORGANIZATION_ID_4 :'||l_invalid_number) ORGANIZATION_ID_4,
6141 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','ORGANIZATION_ID_5 :'||l_invalid_number) ORGANIZATION_ID_5,
6142 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_1,' ','x'))),'0123456789.',' x'))),0),0,' ','BUDGET_AMOUNT_1 :'||l_invalid_number) BUDGET_AMOUNT_1,
6143 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_2,' ','x'))),'0123456789.',' x'))),0),0,' ','BUDGET_AMOUNT_2 :'||l_invalid_number) BUDGET_AMOUNT_2,
6144 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_3,' ','x'))),'0123456789.',' x'))),0),0,' ','BUDGET_AMOUNT_3 :'||l_invalid_number) BUDGET_AMOUNT_3,
6145 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_4,' ','x'))),'0123456789.',' x'))),0),0,' ','BUDGET_AMOUNT_4 :'||l_invalid_number) BUDGET_AMOUNT_4,
6146 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_5,' ','x'))),'0123456789.',' x'))),0),0,' ','BUDGET_AMOUNT_5 :'||l_invalid_number) BUDGET_AMOUNT_5,
6147 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT,' ','x'))),'0123456789.',' x'))),0),0,' ','BUDGET_AMOUNT :'||l_invalid_number) BUDGET_AMOUNT,
6148 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_1,' ','x'))),'0123456789.',' x'))),0),0,' ','QUANTITY_1:'||l_invalid_number) QUANTITY_1,
6149 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_2,' ','x'))),'0123456789.',' x'))),0),0,' ','QUANTITY_2:'||l_invalid_number) QUANTITY_2,
6150 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_3,' ','x'))),'0123456789.',' x'))),0),0,' ','QUANTITY_3:'||l_invalid_number) QUANTITY_3,
6151 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_4,' ','x'))),'0123456789.',' x'))),0),0,' ','QUANTITY_4:'||l_invalid_number) QUANTITY_4,
6152 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_5,' ','x'))),'0123456789.',' x'))),0),0,' ','QUANTITY_5:'||l_invalid_number) QUANTITY_5,
6153 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','SOURCE_PROMOTION_ID_1 :'||l_invalid_number) SOURCE_PROMOTION_ID_1,
6154 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','SOURCE_PROMOTION_ID_2 :'||l_invalid_number) SOURCE_PROMOTION_ID_2,
6155 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','SOURCE_PROMOTION_ID_3 :'||l_invalid_number) SOURCE_PROMOTION_ID_3,
6156 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','SOURCE_PROMOTION_ID_4 :'||l_invalid_number) SOURCE_PROMOTION_ID_4,
6157 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','SOURCE_PROMOTION_ID_5 :'||l_invalid_number) SOURCE_PROMOTION_ID_5,
6158 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','OFFER_ID_1 :'||l_invalid_number) OFFER_ID_1,
6159 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','OFFER_ID_2 :'||l_invalid_number) OFFER_ID_2,
6160 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','OFFER_ID_3 :'||l_invalid_number) OFFER_ID_3,
6161 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','OFFER_ID_4 :'||l_invalid_number) OFFER_ID_4,
6162 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','OFFER_ID_5 :'||l_invalid_number) OFFER_ID_5,
6163 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ASSIGN_SALES_GROUP_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','ASSIGN_SALES_GROUP_ID :'||l_invalid_number) ASSIGN_SALES_GROUP_ID,
6164 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ASSIGN_TO_PERSON_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','ASSIGN_TO_PERSON_ID :'||l_invalid_number) ASSIGN_TO_PERSON_ID,
6165 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ASSIGN_TO_SALESFORCE_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','ASSIGN_TO_SALESFORCE_ID :'||l_invalid_number) ASSIGN_TO_SALESFORCE_ID,
6166 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SCORECARD_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','SCORECARD_ID :'||l_invalid_number) SCORECARD_ID,
6167 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(LOC_HIERARCHY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','LOC_HIERARCHY_ID :'||l_invalid_number) LOC_HIERARCHY_ID,
6168 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(FA_LOCATION_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','FA_LOCATION_ID :'||l_invalid_number) FA_LOCATION_ID,
6169 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PROMOTION_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','PROMOTION_ID :'||l_invalid_number) PROMOTION_ID,
6170 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','OFFER_ID :'||l_invalid_number) OFFER_ID,
6171 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REQUEST_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','REQUEST_ID :'||l_invalid_number) REQUEST_ID,
6172 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PROGRAM_APPLICATION_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','PROGRAM_APPLICATION_ID :'||l_invalid_number) PROGRAM_APPLICATION_ID,
6173 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PROGRAM_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','PROGRAM_ID :'||l_invalid_number) PROGRAM_ID,
6174 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PHONE_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','PHONE_ID :'||l_invalid_number) PHONE_ID,
6175 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CONTACT_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','CONTACT_PARTY_ID :'||l_invalid_number) CONTACT_PARTY_ID,
6176 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECURITY_GROUP_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','SECURITY_GROUP_ID :'||l_invalid_number) SECURITY_GROUP_ID,
6177 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INCUMBENT_PARTNER_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','INCUMBENT_PARTNER_PARTY_ID :'||l_invalid_number) INCUMBENT_PARTNER_PARTY_ID,
6178 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INCUMBENT_PARTNER_RESOURCE_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','INCUMBENT_PARTNER_RESOURCE_ID :'||l_invalid_number) INCUMBENT_PARTNER_RESOURCE_ID,
6179 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','PARTY_ID :'||l_invalid_number) PARTY_ID,
6180 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PARTY_SITE_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','PARTY_SITE_ID :'||l_invalid_number) PARTY_SITE_ID,
6181 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(LOCATION_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','LOCATION_ID :'||l_invalid_number) LOCATION_ID,
6182 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REL_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','REL_PARTY_ID :'||l_invalid_number) REL_PARTY_ID,
6183 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SALES_LEAD_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','SALES_LEAD_ID :'||l_invalid_number) SALES_LEAD_ID,
6184 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(LEAD_RANK_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','LEAD_RANK_ID :'||l_invalid_number) LEAD_RANK_ID,
6185 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_ORDERED_AMOUNT,' ','x'))),'0123456789.',' x'))),0),0,' ','TOTAL_ORDERED_AMOUNT :'||l_invalid_number) TOTAL_ORDERED_AMOUNT,
6186 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_NUM_OF_ORDERS,' ','x'))),'0123456789.',' x'))),0),0,' ','TOTAL_NUM_OF_ORDERS :'||l_invalid_number) TOTAL_NUM_OF_ORDERS,
6187 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(NET_WORTH,' ','x'))),'0123456789.',' x'))),0),0,' ','NET_WORTH :'||l_invalid_number) NET_WORTH,
6188 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CUSTOMER_KEY)),'x')),500) - 500,0,' ','CUSTOMER_KEY :'||l_invalid_size||'(500)') CUSTOMER_KEY,
6189 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_KEY)),'x')),500) - 500,0,' ','ADDRESS_KEY :'||l_invalid_size||'(500)') ADDRESS_KEY,
6190 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTACT_KEY)),'x')),80) - 80,0,' ','CONTACT_KEY :'||l_invalid_size||'(80)') CONTACT_KEY,
6191 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CLOSE_REASON)),'x')),30) - 30,0,' ','CLOSE_REASON :'||l_invalid_size||'(30)') CLOSE_REASON,
6192 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARENT_PROJECT)),'x')),80) - 80,0,' ','PARENT_PROJECT :'||l_invalid_size||'(80)') PARENT_PROJECT,
6193 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION :'||l_invalid_size||'(2000)') DESCRIPTION,
6194 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) -240,0,' ','ORIG_SYSTEM_REFERENCE :'||l_invalid_size||'(240)') ORIG_SYSTEM_REFERENCE,
6195 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_CODE)),'x')),30) - 30,0,' ','ORIG_SYSTEM_CODE :'||l_invalid_size||'(30)') ORIG_SYSTEM_CODE,
6196 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(AUTO_ASSIGNMENT_TYPE)),'x')),30) - 30,0,' ','AUTO_ASSIGNMENT_TYPE :'||l_invalid_size||'(30)') AUTO_ASSIGNMENT_TYPE,
6197 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_ASSIGNMENT_TYPE)),'x')),30) - 30,0,' ','PRM_ASSIGNMENT_TYPE :'||l_invalid_size||'(30)') PRM_ASSIGNMENT_TYPE,
6198 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REJECT_REASON_CODE)),'x')),30) - 30,0,' ','REJECT_REASON_CODE :'||l_invalid_size||'(30)') REJECT_REASON_CODE,
6199 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_STYLE)),'x')),30) - 30,0,' ','ADDRESS_STYLE :'||l_invalid_size||'(30)') ADDRESS_STYLE,
6200 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,' ','ADDRESS_LINES_PHONETIC :'||l_invalid_size||'(560)') ADDRESS_LINES_PHONETIC,
6201 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTENT_SOURCE_TYPE)),'x')),30) - 30,0,' ','CONTENT_SOURCE_TYPE :'||l_invalid_size||'(30)') CONTENT_SOURCE_TYPE,
6202 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOC_DESCRIPTION)),'x')),2000) - 2000,0,' ','LOC_DESCRIPTION :'||l_invalid_size||'(2000)') LOC_DESCRIPTION,
6203 -- bug 4641591: columns obsolete
6204 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,' ','FLOOR :'||l_invalid_size||'(50)') FLOOR,
6205 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,' ','HOUSE_NUMBER :'||l_invalid_size||'(50)') HOUSE_NUMBER,
6206 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,' ','PO_BOX_NUMBER :'||l_invalid_size||'(50)') PO_BOX_NUMBER,
6207 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_POSITION)),'x')),50) - 50,0,' ','LOCATION_POSITION :'||l_invalid_size||'(50)') LOCATION_POSITION,
6208 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LANGUAGE)),'x')),4) - 4,0,' ','LANGUAGE :'||l_invalid_size||'(4)') LANGUAGE,
6209 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,' ','LOCATION_DIRECTIONS :'||l_invalid_size||'(640)') LOCATION_DIRECTIONS,
6210 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),10) - 10,0,' ','POSTAL_PLUS4_CODE :'||l_invalid_size||'(10)') POSTAL_PLUS4_CODE,
6211 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALES_TAX_GEOCODE)),'x')),30) - 30,0,' ','SALES_TAX_GEOCODE :'||l_invalid_size||'(30)') SALES_TAX_GEOCODE,
6212 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALES_TAX_INSIDE_CITY_LIMITS)),'x')),30) - 30,0,' ','SALES_TAX_INSIDE_CITY_LIMITS :'||l_invalid_size||'(30)') SALES_TAX_INSIDE_CITY_LIMITS,
6213 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,' ','STREET :'||l_invalid_size||'(50)') STREET,
6214 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,' ','STREET_NUMBER :'||l_invalid_size||'(50)') STREET_NUMBER,
6215 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,' ','STREET_SUFFIX :'||l_invalid_size||'(50)') STREET_SUFFIX,
6216 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SUITE)),'x')),50) - 50,0,' ','SUITE :'||l_invalid_size||'(50)') SUITE,
6217 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,' ','TIME_ZONE :'||l_invalid_size||'(50)') TIME_ZONE,
6218 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) -240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,/*
6219 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DUNS_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,' ','DUNS_NUMBER :'||l_invalid_number) DUNS_NUMBER, */
6220 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DUNS_NUMBER)),'x')),30) - 30,0,' ','DUNS_NUMBER:'||l_invalid_size||'(30)') DUNS_NUMBER,
6221 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GROUP_TYPE)),'x')),30) - 30,0,' ','GROUP_TYPE :'||l_invalid_size||'(30)') GROUP_TYPE,
6222 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HQ_BRANCH_IND)),'x')),30) - 30,0,' ','HQ_BRANCH_IND :'||l_invalid_size||'(30)') HQ_BRANCH_IND,
6223 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JGZZ_FISCAL_CODE)),'x')),20) - 20,0,' ','JGZZ_FISCAL_CODE :'||l_invalid_size||'(20)') JGZZ_FISCAL_CODE,
6224 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LANGUAGE_NAME)),'x')),30) - 30,0,' ','LANGUAGE_NAME :'||l_invalid_size||'(30)') LANGUAGE_NAME,
6225 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_NUMBER)),'x')),30) - 30,0,' ','PARTY_NUMBER :'||l_invalid_size||'(30)') PARTY_NUMBER,
6226 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MISSION_STATEMENT)),'x')),2000) - 2000,0,' ','MISSION_STATEMENT :'||l_invalid_size||'(2000)') MISSION_STATEMENT,
6227 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_NAME_PHONETIC)),'x')),320) - 320,0,' ','ORGANIZATION_NAME_PHONETIC :'||l_invalid_size||'(320)') ORGANIZATION_NAME_PHONETIC,
6228 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_FIRST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_FIRST_NAME_PHONETIC,
6229 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_IDENTIFIER)),'x')),60) - 60,0,' ','PERSON_IDENTIFIER :'||l_invalid_size||'(60)') PERSON_IDENTIFIER,
6230 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_LAST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_LAST_NAME_PHONETIC,
6231 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_NAME)),'x')),60) - 60,0,' ','TAX_NAME :'||l_invalid_size||'(60)') TAX_NAME,
6232 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_IDEN_TYPE)),'x')),30) - 30,0,' ','PERSON_IDEN_TYPE :'||l_invalid_size||'(30)') PERSON_IDEN_TYPE,
6233 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,' ','PERSON_NAME_SUFFIX :'||l_invalid_size||'(30)') PERSON_NAME_SUFFIX,
6234 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE_TYPE)),'x')),30) - 30,0,' ','SIC_CODE_TYPE :'||l_invalid_size||'(30)') SIC_CODE_TYPE,
6235 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_LAST_NAME)),'x')),150) - 150,0,' ','PERSON_PREVIOUS_LAST_NAME :'||l_invalid_size||'(150)') PERSON_PREVIOUS_LAST_NAME,
6236 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_IND_CLASSIFICATION_CODE)),'x')),30) - 30,0,' ','PRM_IND_CLASSIFICATION_CODE :'||l_invalid_size||'(30)') PRM_IND_CLASSIFICATION_CODE,
6237 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_TYPE)),'x')),30) - 30,0,' ','PARTY_TYPE :'||l_invalid_size||'(30)') PARTY_TYPE,
6238 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LEAD_NUMBER)),'x')),30) - 30,0,' ','LEAD_NUMBER :'||l_invalid_size||'(30)') LEAD_NUMBER,
6239 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_SALES_LEAD_TYPE)),'x')),30) - 30,0,' ','PRM_SALES_LEAD_TYPE :'||l_invalid_size||'(30)') PRM_SALES_LEAD_TYPE,
6240 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT_CODE)),'x')),30) - 30,0,' ','DEPARTMENT_CODE :'||l_invalid_size||'(30)') DEPARTMENT_CODE,
6241 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RANK)),'x')),30) - 30,0,' ','RANK :'||l_invalid_size||'(30)') RANK,
6242 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ROLE_LEVEL)),'x')),30) - 30,0,' ','ROLE_LEVEL :'||l_invalid_size||'(30)') ROLE_LEVEL,
6243 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CNT_PNT_CONTENT_SOURCE_TYPE)),'x')),30) - 30,0,' ','CNT_PNT_CONTENT_SOURCE_TYPE :'||l_invalid_size||'(30)') CNT_PNT_CONTENT_SOURCE_TYPE,
6244 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,' ','PHONE_COUNTRY_CODE :'||l_invalid_size||'(30)') PHONE_COUNTRY_CODE,
6245 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),30) - 30,0,' ','FAX_COUNTRY_CODE :'||l_invalid_size||'(30)') FAX_COUNTRY_CODE,
6246 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_CALLING_CALENDAR)),'x')),30) - 30,0,' ','PHONE_CALLING_CALENDAR :'||l_invalid_size||'(30)') PHONE_CALLING_CALENDAR,
6247 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_FORMAT)),'x')),30) - 30,0,' ','EMAIL_FORMAT :'||l_invalid_size||'(30)') EMAIL_FORMAT,
6248 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CNT_TITLE)),'x')),30) - 30,0,' ','ORG_CNT_TITLE :'||l_invalid_size||'(30)') ORG_CNT_TITLE,
6249 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CNT_PNT_TIME_ZONE,' ','x'))),'0123456789.',' x'))),0),0,' ','CNT_PNT_TIME_ZONE :'||l_invalid_number) CNT_PNT_TIME_ZONE,
6250 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RAW_PHONE_NUMBER)),'x')),60) - 60,0,' ','RAW_PHONE_NUMBER :'||l_invalid_size||'(60)') RAW_PHONE_NUMBER,
6251 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_EXTENSION)),'x')),20) - 20,0,' ','FAX_EXTENSION :'||l_invalid_size||'(20)') FAX_EXTENSION,
6252 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT)),'x')),60) - 60,0,' ','DEPARTMENT :'||l_invalid_size||'(60)') DEPARTMENT,
6253 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRIMARY_CONTACT_PER_ROLE_TYPE)),'x')),1) - 1,0,' ','PRIMARY_CONTACT_PER_ROLE_TYPE :'||l_invalid_size||'(1)') PRIMARY_CONTACT_PER_ROLE_TYPE,
6254 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRIMARY_PER_TYPE)),'x')),1) - 1,0,' ','PRIMARY_PER_TYPE :'||l_invalid_size||'(1)') PRIMARY_PER_TYPE,
6255 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_USES_COMMENTS)),'x')),240) - 240,0,' ','PS_USES_COMMENTS :'||l_invalid_size||'(240)') PS_USES_COMMENTS,
6256 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_SITE_NAME)),'x')),240) - 240,0,' ','PARTY_SITE_NAME :'||l_invalid_size||'(240)') PARTY_SITE_NAME,
6257 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CNT_COMMENTS)),'x')),240) - 240,0,' ','ORG_CNT_COMMENTS :'||l_invalid_size||'(240)') ORG_CNT_COMMENTS,
6258 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SITE_USE_TYPE)),'x')),30) - 30,0,' ','SITE_USE_TYPE :'||l_invalid_size||'(30)') SITE_USE_TYPE,
6259 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_SITE_NUMBER)),'x')),30) - 30,0,' ','PARTY_SITE_NUMBER :'||l_invalid_size||'(30)') PARTY_SITE_NUMBER,
6260 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTACT_NUMBER)),'x')),30) - 30,0,' ','CONTACT_NUMBER :'||l_invalid_size||'(30)') CONTACT_NUMBER,
6261 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESSEE)),'x')),360) - 360,0,' ','ADDRESSEE :'||l_invalid_size||'(360)') ADDRESSEE,
6262 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MAILSTOP)),'x')),60) - 60,0,' ','MAILSTOP :'||l_invalid_size||'(60)') MAILSTOP,
6263 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(MARKETING_SCORE,' ','x'))),'0123456789.',' x'))),0),0,' ','MARKETING_SCORE :'||l_invalid_number) MARKETING_SCORE,
6264 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_INITIALS)),'x')),6) - 6,0,' ','PERSON_INITIALS :'||l_invalid_size||'(6)') PERSON_INITIALS,
6265 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_1,' ','x'))),'0123456789.',' x'))),0),0,' ','CATEGORY_ID_1 :'||l_invalid_number) CATEGORY_ID_1,
6266 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_2,' ','x'))),'0123456789.',' x'))),0),0,' ','CATEGORY_ID_2 :'||l_invalid_number) CATEGORY_ID_2,
6267 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_3,' ','x'))),'0123456789.',' x'))),0),0,' ','CATEGORY_ID_3 :'||l_invalid_number) CATEGORY_ID_3,
6268 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_4,' ','x'))),'0123456789.',' x'))),0),0,' ','CATEGORY_ID_4 :'||l_invalid_number) CATEGORY_ID_4,
6269 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_5,' ','x'))),'0123456789.',' x'))),0),0,' ','CATEGORY_ID_5 :'||l_invalid_number) CATEGORY_ID_5,
6270 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SALES_METHODOLOGY_ID,' ','x'))),'0123456789.','
6271 x'))),0),0,' ','SALES_METHODOLOGY_ID :'||l_invalid_number) SALES_METHODOLOGY_ID,
6272 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DUNS_NUMBER_C)),'x')),30) - 30,0,' ','DUNS_NUMBER_C :'||l_invalid_size||'(30)') DUNS_NUMBER_C,
6273 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SOURCE_PRIMARY_REFERENCE)),'x')),30) - 30,0,' ','SOURCE_PRIMARY_REFERENCE :'||l_invalid_size||'(30)') SOURCE_PRIMARY_REFERENCE,
6274 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SOURCE_SECONDARY_REFERENCE)),'x')),30) - 30,0,' ','SOURCE_SECONDARY_REFERENCE :'||l_invalid_size||'(30)') SOURCE_SECONDARY_REFERENCE,
6275 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NOTE_TYPE)),'x')),30) - 30,0,' ','NOTE_TYPE :'||l_invalid_size||'(30)')
6276 NOTE_TYPE
6277 FROM ams_lead_mapping_v
6278 WHERE import_list_header_id = p_import_list_header_id
6279 and load_status in ('ACTIVE','RELOAD')
6280 and
6281 (
6282 DECODE(GREATEST(lengthb(LTRIM(RTRIM(source_system))),30) - 30,0,'OK','NO') = 'NO'
6283 or
6284 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LEAD_NOTE)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
6285 or
6286 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROMOTION_CODE)),'x')),50) - 50,0,'OK','NO') = 'NO'
6287 or
6288 DECODE(GREATEST(lengthb(LTRIM(RTRIM(CUSTOMER_NAME))),255) - 255,0,'OK','NO') = 'NO'
6289 or
6290 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6291 or
6292 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ANALYSIS_FY)),'x')),5) - 5,0,'OK','NO') = 'NO'
6293 or
6294 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CUSTOMER_CATEGORY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6295 or
6296 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DUNS_NUMBER_C)),'x')),30) - 30,0,'OK','NO') = 'NO'
6297 or
6298 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SOURCE_PRIMARY_REFERENCE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6299 or
6300 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SOURCE_SECONDARY_REFERENCE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6301 or
6302 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NOTE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6303 or
6304 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6305 or
6306 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6307 or
6308 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6309 or
6310 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6311 or
6312 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CATEGORY_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6313 or
6314 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SALES_METHODOLOGY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6315 or
6316 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FISCAL_YEAREND_MONTH)),'x')),30) - 30,0,'OK','NO') = 'NO'
6317 or
6318 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(num_of_employees,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6319 or
6320 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(POTENTIAL_REVENUE_CURR_FY,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6321 or
6322 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(POTENTIAL_REVENUE_NEXT_FY,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6323 or
6324 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CUSTOMER_RANK)),'x')),30) - 30,0,'OK','NO') = 'NO'
6325 or
6326 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),50) - 50,0,'OK','NO') = 'NO'
6327 or
6328 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(YEAR_ESTABLISHED,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6329 or
6330 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDR_DO_NOT_MAIL_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6331 or
6332 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
6333 or
6334 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONT_DO_NOT_MAIL_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6335 or
6336 DECODE(GREATEST(lengthb(LTRIM(RTRIM(COUNTRY))),60) - 60,0,'OK','NO') = 'NO'
6337 or
6338 DECODE(GREATEST(lengthb(LTRIM(RTRIM(ADDRESS1))),240) - 240,0,'OK','NO') = 'NO'
6339 or
6340 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
6341 or
6342 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
6343 or
6344 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
6345 or
6346 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
6347 or
6348 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
6349 or
6350 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
6351 or
6352 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
6353 or
6354 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
6355 or
6356 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
6357 or
6358 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SEX_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6359 or
6360 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALUTATION)),'x')),60) - 60,0,'OK','NO') = 'NO'
6361 or
6362 DECODE(GREATEST(lengthb(LTRIM(RTRIM(LAST_NAME))),50) - 50,0,'OK','NO') = 'NO'
6363 or
6364 DECODE(GREATEST(lengthb(LTRIM(RTRIM(FIRST_NAME))),40) - 40,0,'OK','NO') = 'NO'
6365 or
6366 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TITLE)),'x')),40) - 40,0,'OK','NO') = 'NO'
6367 or
6368 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE)),'x')),100) - 100,0,'OK','NO') = 'NO'
6369 or
6370 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
6371 or
6372 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_STATUS)),'x')),1) - 1,0,'OK','NO') = 'NO'
6373 or
6374 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6375 or
6376 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
6377 or
6378 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EXTENSION)),'x')),20) - 20,0,'OK','NO') = 'NO'
6379 or
6380 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_INITIAL)),'x')),10) - 10,0,'OK','NO') = 'NO'
6381 or
6382 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6383 or
6384 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MAIL_STOP)),'x')),60) - 60,0,'OK','NO') = 'NO'
6385 or
6386 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
6387 or
6388 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
6389 or
6390 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DO_NOT_PHONE_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6391 or
6392 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DO_NOT_FAX_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6393 or
6394 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DO_NOT_EMAIL_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6395 or
6396 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URGENT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6397 or
6398 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ACCEPT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6399 or
6400 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DELETED_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6401 or
6402 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(IMPORT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6403 or
6404 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KEEP_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6405 or
6406 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(QUALIFIED_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6407 or
6408 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRIMARY_CONTACT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6409 or
6410 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOC_VALIDATED_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6411 or
6412 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GSA_INDICATOR_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6413 or
6414 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_REFERENCE_USE_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6415 or
6416 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTIES_VALIDATED_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6417 or
6418 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6419 or
6420 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_EXEC_SPONSOR_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6421 or
6422 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_PRJ_LEAD_IN_PLACE_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6423 or
6424 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_PARTY_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6425 or
6426 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_LOC_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6427 or
6428 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_PS_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6429 or
6430 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_REL_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6431 or
6432 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NEW_CON_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
6433 or
6434 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTACT_ROLE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6435 or
6436 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CHANNEL_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6437 or
6438 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUDGET_STATUS_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6439 or
6440 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_TIMEFRAME_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6441 or
6442 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CURRENCY_CODE)),'x')),15) - 15,0,'OK','NO') = 'NO'
6443 or
6444 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6445 or
6446 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_1)),'x')),3) - 3,0,'OK','NO') = 'NO'
6447 or
6448 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_2)),'x')),3) - 3,0,'OK','NO') = 'NO'
6449 or
6450 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_3)),'x')),3) - 3,0,'OK','NO') = 'NO'
6451 or
6452 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_4)),'x')),3) - 3,0,'OK','NO') = 'NO'
6453 or
6454 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(UOM_CODE_5)),'x')),3) - 3,0,'OK','NO') = 'NO'
6455 or
6456 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
6457 or
6458 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
6459 or
6460 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
6461 or
6462 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
6463 or
6464 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
6465 or
6466 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6467 or
6468 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6469 or
6470 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6471 or
6472 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6473 or
6474 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INTEREST_TYPE_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6475 or
6476 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6477 or
6478 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6479 or
6480 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6481 or
6482 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6483 or
6484 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PRIMARY_INTEREST_CODE_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6485 or
6486 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6487 or
6488 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6489 or
6490 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6491 or
6492 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6493 or
6494 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECONDARY_INTEREST_CODE_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6495 or
6496 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6497 or
6498 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6499 or
6500 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6501 or
6502 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6503 or
6504 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INVENTORY_ITEM_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6505 or
6506 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6507 or
6508 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6509 or
6510 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6511 or
6512 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6513 or
6514 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ORGANIZATION_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6515 or
6516 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6517 or
6518 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6519 or
6520 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6521 or
6522 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6523 or
6524 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6525 or
6526 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(BUDGET_AMOUNT,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6527 or
6528 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6529 or
6530 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6531 or
6532 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6533 or
6534 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6535 or
6536 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(QUANTITY_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6537 or
6538 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6539 or
6540 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6541 or
6542 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6543 or
6544 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6545 or
6546 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SOURCE_PROMOTION_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6547 or
6548 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_1,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6549 or
6550 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_2,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6551 or
6552 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_3,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6553 or
6554 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_4,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6555 or
6556 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID_5,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6557 or
6558 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ASSIGN_SALES_GROUP_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6559 or
6560 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ASSIGN_TO_PERSON_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6561 or
6562 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SCORECARD_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6563 or
6564 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(LOC_HIERARCHY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6565 or
6566 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(FA_LOCATION_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6567 or
6568 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PROMOTION_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6569 or
6570 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(OFFER_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6571 or
6572 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REQUEST_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6573 or
6574 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PROGRAM_APPLICATION_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6575 or
6576 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PROGRAM_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6577 or
6578 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PHONE_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6579 or
6580 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CONTACT_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6581 or
6582 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SECURITY_GROUP_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6583 or
6584 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INCUMBENT_PARTNER_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6585 or
6586 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(INCUMBENT_PARTNER_RESOURCE_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6587 or
6588 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6589 or
6590 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PARTY_SITE_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6591 or
6592 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(LOCATION_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6593 or
6594 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REL_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6595 or
6596 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(SALES_LEAD_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6597 or
6598 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(LEAD_RANK_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6599 or
6600 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_ORDERED_AMOUNT,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6601 or
6602 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_NUM_OF_ORDERS,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6603 or
6604 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(NET_WORTH,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6605 or
6606 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CUSTOMER_KEY)),'x')),500) - 500,0,'OK','NO') = 'NO'
6607 or
6608 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_KEY)),'x')),500) - 500,0,'OK','NO') = 'NO'
6609 or
6610 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTACT_KEY)),'x')),80) - 80,0,'OK','NO') = 'NO'
6611 or
6612 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CLOSE_REASON)),'x')),30) - 30,0,'OK','NO') = 'NO'
6613 or
6614 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARENT_PROJECT)),'x')),80) - 80,0,'OK','NO') = 'NO'
6615 or
6616 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
6617 or
6618 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,'OK','NO') = 'NO'
6619 or
6620 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6621 or
6622 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(AUTO_ASSIGNMENT_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6623 or
6624 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_ASSIGNMENT_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6625 or
6626 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REJECT_REASON_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6627 or
6628 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_STYLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6629 or
6630 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,'OK','NO') = 'NO'
6631 or
6632 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTENT_SOURCE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6633 or
6634 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOC_DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
6635 or
6636 /*
6637 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,'OK','NO') = 'NO'
6638 or
6639 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
6640 or
6641 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
6642 or
6643 */
6644 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_POSITION)),'x')),50) - 50,0,'OK','NO') = 'NO'
6645 or
6646 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LANGUAGE)),'x')),4) - 4,0,'OK','NO') = 'NO'
6647 or
6648 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,'OK','NO') = 'NO'
6649 or
6650 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
6651 or
6652 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALES_TAX_GEOCODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6653 or
6654 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALES_TAX_INSIDE_CITY_LIMITS)),'x')),30) - 30,0,'OK','NO') = 'NO'
6655 or
6656 /*
6657 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,'OK','NO') = 'NO'
6658 or
6659 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
6660 or
6661 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,'OK','NO') = 'NO'
6662 or
6663 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SUITE)),'x')),50) - 50,0,'OK','NO') = 'NO'
6664 or
6665 */
6666 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,'OK','NO') = 'NO'
6667 or
6668 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,'OK','NO') = 'NO'
6669 /* or
6670 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DUNS_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6671 */
6672 or
6673 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DUNS_NUMBER)),'x')),30) - 30,0,'OK','NO') = 'NO'
6674 or
6675 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GROUP_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6676 or
6677 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HQ_BRANCH_IND)),'x')),30) - 30,0,'OK','NO') = 'NO'
6678 or
6679 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JGZZ_FISCAL_CODE)),'x')),20) - 20,0,'OK','NO') = 'NO'
6680 or
6681 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LANGUAGE_NAME)),'x')),30) - 30,0,'OK','NO') = 'NO'
6682 or
6683 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HQ_BRANCH_IND)),'x')),30) - 30,0,'OK','NO') = 'NO'
6684 or
6685 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MISSION_STATEMENT)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
6686 or
6687 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_NAME_PHONETIC)),'x')),320) - 320,0,'OK','NO') = 'NO'
6688 or
6689 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
6690 or
6691 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_IDENTIFIER)),'x')),60) - 60,0,'OK','NO') = 'NO'
6692 or
6693 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
6694 or
6695 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
6696 or
6697 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_IDEN_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6698 or
6699 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
6700 or
6701 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6702 or
6703 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_LAST_NAME)),'x')),150) - 150,0,'OK','NO') = 'NO'
6704 or
6705 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_IND_CLASSIFICATION_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6706 or
6707 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6708 or
6709 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LEAD_NUMBER)),'x')),30) - 30,0,'OK','NO') = 'NO'
6710 or
6711 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRM_SALES_LEAD_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6712 or
6713 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6714 or
6715 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RANK)),'x')),30) - 30,0,'OK','NO') = 'NO'
6716 or
6717 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ROLE_LEVEL)),'x')),30) - 30,0,'OK','NO') = 'NO'
6718 or
6719 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CNT_PNT_CONTENT_SOURCE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6720 or
6721 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6722 or
6723 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6724 or
6725 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_CALLING_CALENDAR)),'x')),30) - 30,0,'OK','NO') = 'NO'
6726 or
6727 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_FORMAT)),'x')),30) - 30,0,'OK','NO') = 'NO'
6728 or
6729 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CNT_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6730 or
6731 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CNT_PNT_TIME_ZONE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6732 or
6733 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RAW_PHONE_NUMBER)),'x')),60) - 60,0,'OK','NO') = 'NO'
6734 or
6735 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_EXTENSION)),'x')),20) - 20,0,'OK','NO') = 'NO'
6736 or
6737 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT)),'x')),60) - 60,0,'OK','NO') = 'NO'
6738 or
6739 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRIMARY_CONTACT_PER_ROLE_TYPE)),'x')),1) - 1,0,'OK','NO') = 'NO'
6740 or
6741 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRIMARY_PER_TYPE)),'x')),1) - 1,0,'OK','NO') = 'NO'
6742 or
6743 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_USES_COMMENTS)),'x')),240) - 240,0,'OK','NO') = 'NO'
6744 or
6745 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_SITE_NAME)),'x')),240) - 240,0,'OK','NO') = 'NO'
6746 or
6747 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CNT_COMMENTS)),'x')),240) - 240,0,'OK','NO') = 'NO'
6748 or
6749 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SITE_USE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
6750 or
6751 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PARTY_SITE_NUMBER)),'x')),30) - 30,0,'OK','NO') = 'NO'
6752 or
6753 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONTACT_NUMBER)),'x')),30) - 30,0,'OK','NO') = 'NO'
6754 or
6755 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESSEE)),'x')),360) - 360,0,'OK','NO') = 'NO'
6756 or
6757 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MAILSTOP)),'x')),60) - 60,0,'OK','NO') = 'NO'
6758 or
6759 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(MARKETING_SCORE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
6760 or
6761 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_INITIALS)),'x')),6) - 6,0,'OK','NO') = 'NO'
6762 )
6763 ;
6764
6765 CURSOR c_lead_batch_id is
6766 SELECT
6767 batch_id
6768 FROM ams_imp_list_headers_all
6769 WHERE import_list_header_id = p_import_list_header_id;
6770
6771 CURSOR c_lead_date_fields is
6772 SELECT
6773 import_list_header_id,
6774 import_source_line_id,
6775 assign_date,
6776 address_effective_date,
6777 last_ordered_date,
6778 program_update_date,
6779 lead_date
6780 FROM ams_lead_mapping_v
6781 WHERE import_list_header_id = p_import_list_header_id
6782 and load_status in ('ACTIVE','RELOAD')
6783 AND (assign_date is not null or address_effective_date is not null or
6784 last_ordered_date is not null or program_update_date is not null
6785 or lead_date is not null);
6786
6787 CURSOR c_source_system is
6788 SELECT COUNT(*) total_rec, source_system FROM ams_lead_mapping_v
6789 WHERE import_list_header_id = p_import_list_header_id
6790 GROUP BY source_system ORDER BY COUNT(*) DESC;
6791
6792
6793 CURSOR c_invalid_src_sys is
6794 SELECT
6795 import_list_header_id,
6796 import_source_line_id
6797 FROM ams_lead_mapping_v
6798 WHERE import_list_header_id = p_import_list_header_id
6799 AND source_system <> l_source_system;
6800
6801 cursor c_error_exists is
6802 select 'Y'
6803 from ams_list_import_errors
6804 where import_list_header_id = x_import_source_line_id
6805 and import_source_line_id = x_import_source_line_id
6806 and batch_id = l_batch_id;
6807
6808 begin
6809
6810 IF p_import_list_header_id IS NULL THEN
6811 RAISE FND_API.G_EXC_ERROR;
6812 END IF;
6813 p_return_status := FND_API.G_RET_STS_SUCCESS;
6814
6815 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_DATATYPE_ERROR_CHK');
6816 l_invalid_number := FND_MESSAGE.get;
6817 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_SIZE_ERROR_CHK');
6818 l_invalid_size := FND_MESSAGE.get;
6819 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_NULL_ERROR_CHK');
6820 l_null_value := FND_MESSAGE.get;
6821 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_SOUR_SYS_ERROR_CHK');
6822 l_invalid_src_system := FND_MESSAGE.get;
6823
6824 OPEN c_lead_batch_id;
6825 FETCH c_lead_batch_id into l_batch_id;
6826 CLOSE c_lead_batch_id;
6827
6828 OPEN c_lead_fields;
6829 LOOP
6830 FETCH c_lead_fields BULK COLLECT INTO
6831 l_import_source_line_id,
6832 l_import_list_header_id,
6833 l_col1 ,
6834 l_col2 ,
6835 l_col3 ,
6836 l_col4 ,
6837 l_col5 ,
6838 l_col6 ,
6839 l_col7 ,
6840 l_col8 ,
6841 l_col9 ,
6842 l_col10 ,
6843 l_col11 ,
6844 l_col12 ,
6845 l_col13 ,
6846 l_col14 ,
6847 l_col15 ,
6848 l_col16 ,
6849 l_col17 ,
6850 l_col18 ,
6851 l_col19 ,
6852 l_col20 ,
6853 l_col21 ,
6854 l_col22 ,
6855 l_col23 ,
6856 l_col24 ,
6857 l_col25 ,
6858 l_col26 ,
6859 l_col27 ,
6860 l_col28 ,
6861 l_col29 ,
6862 l_col30 ,
6863 l_col31 ,
6864 l_col32 ,
6865 l_col33 ,
6866 l_col34 ,
6867 l_col35 ,
6868 l_col36 ,
6869 l_col37 ,
6870 l_col38 ,
6871 l_col39 ,
6872 l_col40 ,
6873 l_col41 ,
6874 l_col42 ,
6875 l_col43 ,
6876 l_col44 ,
6877 l_col45 ,
6878 l_col46 ,
6879 l_col47 ,
6880 l_col48 ,
6881 l_col49 ,
6882 l_col50 ,
6883 l_col51 ,
6884 l_col52 ,
6885 l_col53 ,
6886 l_col54 ,
6887 l_col55 ,
6888 l_col56 ,
6889 l_col57 ,
6890 l_col58 ,
6891 l_col59 ,
6892 l_col60 ,
6893 l_col61 ,
6894 l_col62 ,
6895 l_col63 ,
6896 l_col64 ,
6897 l_col65 ,
6898 l_col66 ,
6899 l_col67 ,
6900 l_col68 ,
6901 l_col69 ,
6902 l_col70 ,
6903 l_col71 ,
6904 l_col72 ,
6905 l_col73 ,
6906 l_col74 ,
6907 l_col75 ,
6908 l_col76 ,
6909 l_col77 ,
6910 l_col78 ,
6911 l_col79 ,
6912 l_col80 ,
6913 l_col81 ,
6914 l_col82 ,
6915 l_col83 ,
6916 l_col84 ,
6917 l_col85 ,
6918 l_col86 ,
6919 l_col87 ,
6920 l_col88 ,
6921 l_col89 ,
6922 l_col90 ,
6923 l_col91 ,
6924 l_col92 ,
6925 l_col93 ,
6926 l_col94 ,
6927 l_col95 ,
6928 l_col96 ,
6929 l_col97 ,
6930 l_col98 ,
6931 l_col99 ,
6932 l_col100 ,
6933 l_col101 ,
6934 l_col102 ,
6935 l_col103 ,
6936 l_col104 ,
6937 l_col105 ,
6938 l_col106 ,
6939 l_col107 ,
6940 l_col108 ,
6941 l_col109 ,
6942 l_col110 ,
6943 l_col111 ,
6944 l_col112 ,
6945 l_col113 ,
6946 l_col114 ,
6947 l_col115 ,
6948 l_col116 ,
6949 l_col117 ,
6950 l_col118 ,
6951 l_col119 ,
6952 l_col120 ,
6953 l_col121 ,
6954 l_col122 ,
6955 l_col123 ,
6956 l_col124 ,
6957 l_col125 ,
6958 l_col126 ,
6959 l_col127 ,
6960 l_col128 ,
6961 l_col129 ,
6962 l_col130 ,
6963 l_col131 ,
6964 l_col132 ,
6965 l_col133 ,
6966 l_col134 ,
6967 l_col135 ,
6968 l_col136 ,
6969 l_col137 ,
6970 l_col138 ,
6971 l_col139 ,
6972 l_col140 ,
6973 l_col141 ,
6974 l_col142 ,
6975 l_col143 ,
6976 l_col144 ,
6977 l_col145 ,
6978 l_col146 ,
6979 l_col147 ,
6980 l_col148 ,
6981 l_col149 ,
6982 l_col150 ,
6983 l_col151 ,
6984 l_col152 ,
6985 l_col153 ,
6986 l_col154 ,
6987 l_col155 ,
6988 l_col156 ,
6989 l_col157 ,
6990 l_col158 ,
6991 l_col159 ,
6992 l_col160 ,
6993 l_col161 ,
6994 l_col162 ,
6995 l_col163 ,
6996 l_col164 ,
6997 l_col165 ,
6998 l_col166 ,
6999 l_col167 ,
7000 l_col168 ,
7001 -- l_col169 ,
7002 -- l_col170 ,
7003 -- l_col171 ,
7004 l_col172 ,
7005 l_col173 ,
7006 l_col174 ,
7007 l_col175 ,
7008 l_col176 ,
7009 l_col177 ,
7010 -- l_col178 ,
7011 -- l_col179 ,
7012 -- l_col180 ,
7013 -- l_col181 ,
7014 l_col182 ,
7015 l_col183 ,
7016 l_col184 ,
7017 l_col185 ,
7018 l_col186 ,
7019 l_col187 ,
7020 l_col188 ,
7021 l_col189 ,
7022 l_col190 ,
7023 l_col191 ,
7024 l_col192 ,
7025 l_col193 ,
7026 l_col194 ,
7027 l_col195 ,
7028 l_col196 ,
7029 l_col197 ,
7030 l_col198 ,
7031 l_col199 ,
7032 l_col200 ,
7033 l_col201 ,
7034 l_col202 ,
7035 l_col203 ,
7036 l_col204 ,
7037 l_col205 ,
7038 l_col206 ,
7039 l_col207 ,
7040 l_col208 ,
7041 l_col209 ,
7042 l_col210 ,
7043 l_col211 ,
7044 l_col212 ,
7045 l_col213 ,
7046 l_col214 ,
7047 l_col215 ,
7048 l_col216 ,
7049 l_col217 ,
7050 l_col218 ,
7051 l_col219 ,
7052 l_col220 ,
7053 l_col221 ,
7054 l_col222 ,
7055 l_col223 ,
7056 l_col224 ,
7057 l_col225 ,
7058 l_col226 ,
7059 l_col227 ,
7060 l_col228 ,
7061 l_col229,
7062 l_col230,
7063 l_col231,
7064 l_col232,
7065 l_col233,
7066 l_col234,
7067 l_col235,
7068 l_col236,
7069 l_col237,
7070 l_col238
7071 LIMIT L_MAX_ROW_COUNT;
7072
7073
7074 FORALL i IN 1 .. l_import_source_line_id.count
7075 INSERT INTO ams_list_import_errors
7076 (
7077 LIST_IMPORT_ERROR_ID,
7078 LAST_UPDATED_BY,
7079 LAST_UPDATE_DATE,
7080 CREATION_DATE,
7081 CREATED_BY,
7082 LAST_UPDATE_LOGIN,
7083 IMPORT_SOURCE_LINE_ID,
7084 IMPORT_LIST_HEADER_ID,
7085 IMPORT_TYPE,
7086 ERROR_TYPE,
7087 BATCH_ID,
7088 ERROR_FLAG,
7089 col1 ,
7090 col2 ,
7091 col3 ,
7092 col4 ,
7093 col5 ,
7094 col6 ,
7095 col7 ,
7096 col8 ,
7097 col9 ,
7098 col10 ,
7099 col11 ,
7100 col12 ,
7101 col13 ,
7102 col14 ,
7103 col15 ,
7104 col16 ,
7105 col17 ,
7106 col18 ,
7107 col19 ,
7108 col20 ,
7109 col21 ,
7110 col22 ,
7111 col23 ,
7112 col24 ,
7113 col25 ,
7114 col26 ,
7115 col27 ,
7116 col28 ,
7117 col29 ,
7118 col30 ,
7119 col31 ,
7120 col32 ,
7121 col33 ,
7122 col34 ,
7123 col35 ,
7124 col36 ,
7125 col37 ,
7126 col38 ,
7127 col39 ,
7128 col40 ,
7129 col41 ,
7130 col42 ,
7131 col43 ,
7132 col44 ,
7133 col45 ,
7134 col46 ,
7135 col47 ,
7136 col48 ,
7137 col49 ,
7138 col50 ,
7139 col51 ,
7140 col52 ,
7141 col53 ,
7142 col54 ,
7143 col55 ,
7144 col56 ,
7145 col57 ,
7146 col58 ,
7147 col59 ,
7148 col60 ,
7149 col61 ,
7150 col62 ,
7151 col63 ,
7152 col64 ,
7153 col65 ,
7154 col66 ,
7155 col67 ,
7156 col68 ,
7157 col69 ,
7158 col70 ,
7159 col71 ,
7160 col72 ,
7161 col73 ,
7162 col74 ,
7163 col75 ,
7164 col76 ,
7165 col77 ,
7166 col78 ,
7167 col79 ,
7168 col80 ,
7169 col81 ,
7170 col82 ,
7171 col83 ,
7172 col84 ,
7173 col85 ,
7174 col86 ,
7175 col87 ,
7176 col88 ,
7177 col89 ,
7178 col90 ,
7179 col91 ,
7180 col92 ,
7181 col93 ,
7182 col94 ,
7183 col95 ,
7184 col96 ,
7185 col97 ,
7186 col98 ,
7187 col99 ,
7188 col100 ,
7189 col101 ,
7190 col102 ,
7191 col103 ,
7192 col104 ,
7193 col105 ,
7194 col106 ,
7195 col107 ,
7196 col108 ,
7197 col109 ,
7198 col110 ,
7199 col111 ,
7200 col112 ,
7201 col113 ,
7202 col114 ,
7203 col115 ,
7204 col116 ,
7205 col117 ,
7206 col118 ,
7207 col119 ,
7208 col120 ,
7209 col121 ,
7210 col122 ,
7211 col123 ,
7212 col124 ,
7213 col125 ,
7214 col126 ,
7215 col127 ,
7216 col128 ,
7217 col129 ,
7218 col130 ,
7219 col131 ,
7220 col132 ,
7221 col133 ,
7222 col134 ,
7223 col135 ,
7224 col136 ,
7225 col137 ,
7226 col138 ,
7227 col139 ,
7228 col140 ,
7229 col141 ,
7230 col142 ,
7231 col143 ,
7232 col144 ,
7233 col145 ,
7234 col146 ,
7235 col147 ,
7236 col148 ,
7237 col149 ,
7238 col150 ,
7239 col151 ,
7240 col152 ,
7241 col153 ,
7242 col154 ,
7243 col155 ,
7244 col156 ,
7245 col157 ,
7246 col158 ,
7247 col159 ,
7248 col160 ,
7249 col161 ,
7250 col162 ,
7251 col163 ,
7252 col164 ,
7253 col165 ,
7254 col166 ,
7255 col167 ,
7256 col168 ,
7257 -- col169 ,
7258 -- col170 ,
7259 -- col171 ,
7260 col172 ,
7261 col173 ,
7262 col174 ,
7263 col175 ,
7264 col176 ,
7265 col177 ,
7266 -- col178 ,
7267 -- col179 ,
7268 -- col180 ,
7269 -- col181 ,
7270 col182 ,
7271 col183 ,
7272 col184 ,
7273 col185 ,
7274 col186 ,
7275 col187 ,
7276 col188 ,
7277 col189 ,
7278 col190 ,
7279 col191 ,
7280 col192 ,
7281 col193 ,
7282 col194 ,
7283 col195 ,
7284 col196 ,
7285 col197 ,
7286 col198 ,
7287 col199 ,
7288 col200 ,
7289 col201 ,
7290 col202 ,
7291 col203 ,
7292 col204 ,
7293 col205 ,
7294 col206 ,
7295 col207 ,
7296 col208 ,
7297 col209 ,
7298 col210 ,
7299 col211 ,
7300 col212 ,
7301 col213 ,
7302 col214 ,
7303 col215 ,
7304 col216 ,
7305 col217 ,
7306 col218 ,
7307 col219 ,
7308 col220 ,
7309 col221 ,
7310 col222 ,
7311 col223 ,
7312 col224 ,
7313 col225 ,
7314 col226 ,
7315 col227 ,
7316 col228,
7317 col229,
7318 col230,
7319 col231,
7320 col232,
7321 col233,
7322 col234,
7323 col235,
7324 col236,
7325 col237,
7326 col238
7327 )
7328 VALUES
7329 (
7330 ams_list_import_errors_s.nextval, -- LIST_IMPORT_ERROR_ID,
7331 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
7332 SYSDATE, -- LAST_UPDATE_DATE,
7333 SYSDATE, -- CREATION_DATE,
7334 FND_GLOBAL.User_ID, -- CREATED_BY,
7335 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
7336 l_import_source_line_id(i),
7337 l_import_list_header_id(i),
7338 'LEAD', -- IMPORT_TYPE,
7339 'E', -- ERROR_TYPE,
7340 l_batch_id,
7341 'Y',
7342 l_col1(i),
7343 l_col2(i),
7344 l_col3(i),
7345 l_col4(i),
7346 l_col5(i),
7347 l_col6(i),
7348 l_col7(i),
7349 l_col8(i),
7350 l_col9(i),
7351 l_col10(i),
7352 l_col11(i),
7353 l_col12(i),
7354 l_col13(i),
7355 l_col14(i),
7356 l_col15(i),
7357 l_col16(i),
7358 l_col17(i),
7359 l_col18(i),
7360 l_col19(i),
7361 l_col20(i),
7362 l_col21(i),
7363 l_col22(i),
7364 l_col23(i),
7365 l_col24(i),
7366 l_col25(i),
7367 l_col26(i),
7368 l_col27(i),
7369 l_col28(i),
7370 l_col29(i),
7371 l_col30(i),
7372 l_col31(i),
7373 l_col32(i),
7374 l_col33(i),
7375 l_col34(i),
7376 l_col35(i),
7377 l_col36(i),
7378 l_col37(i),
7379 l_col38(i),
7380 l_col39(i),
7381 l_col40(i),
7382 l_col41(i),
7383 l_col42(i),
7384 l_col43(i),
7385 l_col44(i),
7386 l_col45(i),
7387 l_col46(i),
7388 l_col47(i),
7389 l_col48(i),
7390 l_col49(i),
7391 l_col50(i),
7392 l_col51(i),
7393 l_col52(i),
7394 l_col53(i),
7395 l_col54(i),
7396 l_col55(i),
7397 l_col56(i),
7398 l_col57(i),
7399 l_col58(i),
7400 l_col59(i),
7401 l_col60(i),
7402 l_col61(i),
7403 l_col62(i),
7404 l_col63(i),
7405 l_col64(i),
7406 l_col65(i),
7407 l_col66(i),
7408 l_col67(i),
7409 l_col68(i),
7410 -- l_col69(i),
7411 -- l_col70(i),
7412 -- l_col71(i),
7413 l_col72(i),
7414 l_col73(i),
7415 l_col74(i),
7416 l_col75(i),
7417 l_col76(i),
7418 l_col77(i),
7419 -- l_col78(i),
7420 -- l_col79(i),
7421 -- l_col80(i),
7422 -- l_col81(i),
7423 l_col82(i),
7424 l_col83(i),
7425 l_col84(i),
7426 l_col85(i),
7427 l_col86(i),
7428 l_col87(i),
7429 l_col88(i),
7430 l_col89(i),
7431 l_col90(i),
7432 l_col91(i),
7433 l_col92(i),
7434 l_col93(i),
7435 l_col94(i),
7436 l_col95(i),
7437 l_col96(i),
7438 l_col97(i),
7439 l_col98(i),
7440 l_col99(i),
7441 l_col100(i),
7442 l_col101(i),
7443 l_col102(i),
7444 l_col103(i),
7445 l_col104(i),
7446 l_col105(i),
7447 l_col106(i),
7448 l_col107(i),
7449 l_col108(i),
7450 l_col109(i),
7451 l_col110(i),
7452 l_col111(i),
7453 l_col112(i),
7454 l_col113(i),
7455 l_col114(i),
7456 l_col115(i),
7457 l_col116(i),
7458 l_col117(i),
7459 l_col118(i),
7460 l_col119(i),
7461 l_col120(i),
7462 l_col121(i),
7463 l_col122(i),
7464 l_col123(i),
7465 l_col124(i),
7466 l_col125(i),
7467 l_col126(i),
7468 l_col127(i),
7469 l_col128(i),
7470 l_col129(i),
7471 l_col130(i),
7472 l_col131(i),
7473 l_col132(i),
7474 l_col133(i),
7475 l_col134(i),
7476 l_col135(i),
7477 l_col136(i),
7478 l_col137(i),
7479 l_col138(i),
7480 l_col139(i),
7481 l_col140(i),
7482 l_col141(i),
7483 l_col142(i),
7484 l_col143(i),
7485 l_col144(i),
7486 l_col145(i),
7487 l_col146(i),
7488 l_col147(i),
7489 l_col148(i),
7490 l_col149(i),
7491 l_col150(i),
7492 l_col151(i),
7493 l_col152(i),
7494 l_col153(i),
7495 l_col154(i),
7496 l_col155(i),
7497 l_col156(i),
7498 l_col157(i),
7499 l_col158(i),
7500 l_col159(i),
7501 l_col160(i),
7502 l_col161(i),
7503 l_col162(i),
7504 l_col163(i),
7505 l_col164(i),
7506 l_col165(i),
7507 l_col166(i),
7508 l_col167(i),
7509 l_col168(i),
7510 l_col169(i),
7511 l_col170(i),
7512 l_col171(i),
7513 l_col172(i),
7514 l_col173(i),
7515 l_col174(i),
7516 l_col175(i),
7517 l_col176(i),
7518 l_col177(i),
7519 l_col178(i),
7520 l_col179(i),
7521 l_col180(i),
7522 l_col181(i),
7523 l_col182(i),
7524 l_col183(i),
7525 l_col184(i),
7526 l_col185(i),
7527 l_col186(i),
7528 l_col187(i),
7529 l_col188(i),
7530 l_col189(i),
7531 l_col190(i),
7532 l_col191(i),
7533 l_col192(i),
7534 l_col193(i),
7535 l_col194(i),
7536 l_col195(i),
7537 l_col196(i),
7538 l_col197(i),
7539 l_col198(i),
7540 l_col199(i),
7541 l_col200(i),
7542 l_col201(i),
7543 l_col202(i),
7544 l_col203(i),
7545 l_col204(i),
7546 l_col205(i),
7547 l_col206(i),
7548 l_col207(i),
7549 l_col208(i),
7550 l_col209(i),
7551 l_col210(i),
7552 l_col211(i),
7553 l_col212(i),
7554 l_col213(i),
7555 l_col214(i),
7556 l_col215(i),
7557 l_col216(i),
7558 l_col217(i),
7559 l_col218(i),
7560 l_col219(i),
7561 l_col220(i),
7562 l_col221(i),
7563 l_col222(i),
7564 l_col223(i),
7565 l_col224(i),
7566 l_col225(i),
7567 l_col226(i),
7568 l_col227(i),
7569 l_col228(i),
7570 l_col229(i),
7571 l_col230(i),
7572 l_col231(i),
7573 l_col232(i),
7574 l_col233(i),
7575 l_col234(i),
7576 l_col235(i),
7577 l_col236(i),
7578 l_col237(i),
7579 l_col238(i)
7580 );
7581 EXIT WHEN c_lead_fields%NOTFOUND;
7582 END LOOP;
7583 CLOSE c_lead_fields;
7584
7585 OPEN c_lead_date_fields;
7586 LOOP
7587 FETCH c_lead_date_fields into x_import_list_header_id,x_import_source_line_id,l_assign_date,
7588 l_address_effective_date, l_last_ordered_date,l_program_update_date,l_lead_date;
7589 EXIT WHEN c_lead_date_fields%NOTFOUND;
7590 date_validate( x_import_list_header_id,x_import_source_line_id,l_batch_id,l_assign_date,
7591 l_address_effective_date, l_last_ordered_date,l_program_update_date,l_lead_date,null);
7592 End Loop;
7593 CLOSE c_lead_date_fields;
7594
7595 open c_source_system;
7596 fetch c_source_system into l_total_rec, l_source_system;
7597 close c_source_system;
7598 if l_source_system is not NULL then
7599 open c_invalid_src_sys;
7600 loop
7601 fetch c_invalid_src_sys into x_import_list_header_id,x_import_source_line_id;
7602 exit when c_invalid_src_sys%notfound;
7603 l_error_exists := null;
7604 open c_error_exists;
7605 fetch c_error_exists into l_error_exists;
7606 close c_error_exists;
7607 if l_error_exists = 'Y' then
7608 update ams_list_import_errors
7609 set col1 = 'SOURCE_SYSTEM:'||l_invalid_src_system
7610 where import_list_header_id = x_import_list_header_id
7611 and import_source_line_id = x_import_source_line_id
7612 and batch_id = l_batch_id;
7613 end if;
7614 if l_error_exists is null then
7615 INSERT INTO ams_list_import_errors
7616 (
7617 LIST_IMPORT_ERROR_ID,
7618 LAST_UPDATED_BY,
7619 LAST_UPDATE_DATE,
7620 CREATION_DATE,
7621 CREATED_BY,
7622 LAST_UPDATE_LOGIN,
7623 IMPORT_SOURCE_LINE_ID,
7624 IMPORT_LIST_HEADER_ID,
7625 IMPORT_TYPE,
7626 ERROR_TYPE,
7627 BATCH_ID,
7628 col1
7629 )
7630 VALUES
7631 (
7632 ams_list_import_errors_s.nextval, -- LIST_IMPORT_ERROR_ID,
7633 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
7634 SYSDATE, -- LAST_UPDATE_DATE,
7635 SYSDATE, -- CREATION_DATE,
7636 FND_GLOBAL.User_ID, -- CREATED_BY,
7637 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
7638 x_import_source_line_id,
7639 x_import_list_header_id,
7640 'LEAD', -- IMPORT_TYPE,
7641 'E', -- ERROR_TYPE,
7642 l_batch_id,
7643 'SOURCE_SYSTEM:'||l_invalid_src_system);
7644 end if;
7645 end loop;
7646 close c_invalid_src_sys;
7647 end if;
7648
7649 UPDATE ams_imp_source_lines
7650 SET load_status = decode(load_status,'DUPLICATE','DUPLICATE','ERROR')
7651 WHERE import_list_header_id = p_import_list_header_id
7652 and import_source_line_id in
7653 (select import_source_line_id from ams_list_import_errors
7654 where import_list_header_id = p_import_list_header_id
7655 and error_type = 'E');
7656
7657
7658 EXCEPTION
7659 WHEN OTHERS THEN
7660 p_return_status := FND_API.G_RET_STS_ERROR;
7661 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
7662 FND_MESSAGE.Set_Token('ROW','Error in execute_lead_data_validation:' || SQLERRM||' '||SQLCODE);
7663 AMS_Utility_PVT.Create_Log (
7664 x_return_status => l_return_status,
7665 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7666 p_log_used_by_id => p_import_list_header_id,
7667 p_msg_data => FND_MESSAGE.get,
7668 p_msg_type => 'DEBUG'
7669 );
7670
7671 end execute_lead_data_validation;
7672
7673 -- ---------------------------------------
7674 procedure date_validate (
7675 p_import_list_header_id IN NUMBER,
7676 p_import_source_line_id IN NUMBER,
7677 p_batch_id IN NUMBER,
7678 p_column1 IN VARCHAR2,
7679 p_column2 IN VARCHAR2,
7680 p_column3 IN VARCHAR2,
7681 p_column4 IN VARCHAR2,
7682 p_column5 IN VARCHAR2,
7683 p_column6 IN VARCHAR2
7684 ) IS
7685
7686 l_col1 varchar2(1);
7687 l_col2 varchar2(1);
7688 l_col3 varchar2(1);
7689 l_col4 varchar2(1);
7690 l_col5 varchar2(1);
7691 l_col6 varchar2(1);
7692 l_date1 date;
7693 l_date2 date;
7694 l_date3 date;
7695 l_date4 date;
7696 l_date5 date;
7697 l_date6 date;
7698 l_error_exist varchar2(1);
7699 l_imp_type varchar2(60);
7700 l_col11 varchar2(60);
7701 l_col22 varchar2(60);
7702 l_col33 varchar2(60);
7703 l_col44 varchar2(60);
7704 l_col55 varchar2(60);
7705 l_col66 varchar2(60);
7706 l_return_status varchar2(1);
7707 l_invalid_date varchar2(4000) ;
7708
7709 l_org_imp_xml_element_id number;
7710 l_add_imp_xml_element_id number;
7711 l_ocont_imp_xml_element_id number;
7712 l_cp_imp_xml_element_id number;
7713 l_em_imp_xml_element_id number;
7714 l_per_imp_xml_element_id number;
7715 l_file_type varchar2(60);
7716 x_date_format VARCHAR2(50);
7717
7718 cursor c_error_exists is
7719 select 'Y'
7720 from ams_list_import_errors
7721 where import_list_header_id = p_import_list_header_id
7722 and import_source_line_id = p_import_source_line_id
7723 and batch_id = p_batch_id;
7724
7725 cursor c_imp_type is
7726 select import_type
7727 from ams_imp_list_headers_all
7728 where import_list_header_id = p_import_list_header_id;
7729
7730 cursor c_b2bxmlrec is
7731 select org_imp_xml_element_id, add_imp_xml_element_id, ocont_imp_xml_element_id,
7732 cp_imp_xml_element_id, em_imp_xml_element_id
7733 from ams_hz_b2b_mapping_v where import_source_line_id = p_import_source_line_id;
7734
7735 cursor c_b2cxmlrec is
7736 select per_imp_xml_element_id, add_imp_xml_element_id,cp_imp_xml_element_id, em_imp_xml_element_id
7737 from ams_hz_b2c_mapping_v where import_source_line_id = p_import_source_line_id;
7738
7739 cursor c_file_type is
7740 select file_type from AMS_IMP_DOCUMENTS where import_list_header_id = p_import_list_header_id;
7741
7742 begin
7743 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_DATE_VAL_ERROR_CHK');
7744 l_invalid_date := FND_MESSAGE.get;
7745 x_date_format := fnd_profile.value('ICX_DATE_FORMAT_MASK');
7746 open c_file_type;
7747 fetch c_file_type into l_file_type;
7748 close c_file_type;
7749
7750 open c_b2bxmlrec;
7751 fetch c_b2bxmlrec into l_org_imp_xml_element_id, l_add_imp_xml_element_id, l_ocont_imp_xml_element_id,
7752 l_cp_imp_xml_element_id, l_em_imp_xml_element_id;
7753 close c_b2bxmlrec;
7754 open c_imp_type;
7755 fetch c_imp_type into l_imp_type;
7756 close c_imp_type;
7757 open c_error_exists;
7758 fetch c_error_exists into l_error_exist;
7759 close c_error_exists;
7760
7761 if l_imp_type = 'B2B' then
7762 open c_b2bxmlrec;
7763 fetch c_b2bxmlrec into l_org_imp_xml_element_id, l_add_imp_xml_element_id, l_ocont_imp_xml_element_id,
7764 l_cp_imp_xml_element_id, l_em_imp_xml_element_id;
7765 close c_b2bxmlrec;
7766 end if;
7767 if l_imp_type = 'B2C' then
7768 open c_b2cxmlrec;
7769 fetch c_b2cxmlrec into l_per_imp_xml_element_id, l_add_imp_xml_element_id,
7770 l_cp_imp_xml_element_id, l_em_imp_xml_element_id;
7771 close c_b2cxmlrec;
7772 end if;
7773 l_col1 := null;
7774 l_col2 := null;
7775 l_col3 := null;
7776 l_col4 := null;
7777 l_col5 := null;
7778 l_col6 := null;
7779 /*
7780 AMS_Utility_PVT.Create_Log (
7781 x_return_status => l_return_status,
7782 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7783 p_log_used_by_id => p_import_list_header_id,
7784 p_msg_data => 'p_column1 = '||p_column1,
7785 p_msg_type => 'DEBUG'
7786 );
7787 AMS_Utility_PVT.Create_Log (
7788 x_return_status => l_return_status,
7789 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7790 p_log_used_by_id => p_import_list_header_id,
7791 p_msg_data => 'p_column2 = '||p_column2,
7792 p_msg_type => 'DEBUG'
7793 );
7794 AMS_Utility_PVT.Create_Log (
7795 x_return_status => l_return_status,
7796 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7797 p_log_used_by_id => p_import_list_header_id,
7798 p_msg_data => 'p_column3 = '||p_column3,
7799 p_msg_type => 'DEBUG'
7800 );
7801 AMS_Utility_PVT.Create_Log (
7802 x_return_status => l_return_status,
7803 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7804 p_log_used_by_id => p_import_list_header_id,
7805 p_msg_data => 'p_column4 = '||p_column4,
7806 p_msg_type => 'DEBUG'
7807 );
7808 AMS_Utility_PVT.Create_Log (
7809 x_return_status => l_return_status,
7810 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7811 p_log_used_by_id => p_import_list_header_id,
7812 p_msg_data => 'p_column5 = '||p_column5,
7813 p_msg_type => 'DEBUG'
7814 );
7815 AMS_Utility_PVT.Create_Log (
7816 x_return_status => l_return_status,
7817 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7818 p_log_used_by_id => p_import_list_header_id,
7819 p_msg_data => 'p_column6 = '||p_column6,
7820 p_msg_type => 'DEBUG'
7821 );
7822 */
7823 if p_column1 is not null then
7824 begin
7825 -- l_date1 := to_date(p_column1,'MM/DD/YYYY');
7826 select to_date(p_column1, x_date_format) into l_date1 from dual;
7827 AMS_Utility_PVT.Create_Log (
7828 x_return_status => l_return_status,
7829 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7830 p_log_used_by_id => p_import_list_header_id,
7831 p_msg_data => 'l_date1 = '||to_char(l_date1),
7832 p_msg_type => 'DEBUG'
7833 );
7834
7835 exception
7836 when others then
7837 l_col1 := 'Y';
7838 end;
7839 end if;
7840 if p_column2 is not null then
7841 begin
7842 -- l_date2 := to_date(p_column2,'MM/DD/YYYY');
7843 select to_date(p_column2, x_date_format) into l_date2 from dual;
7844 AMS_Utility_PVT.Create_Log (
7845 x_return_status => l_return_status,
7846 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7847 p_log_used_by_id => p_import_list_header_id,
7848 p_msg_data => 'l_date2 = '||to_char(l_date2),
7849 p_msg_type => 'DEBUG'
7850 );
7851
7852 exception
7853 when others then
7854 l_col2 := 'Y';
7855 end;
7856 end if;
7857 if p_column3 is not null then
7858 begin
7859 -- l_date3 := to_date(p_column3,'MM/DD/YYYY');
7860 select to_date(p_column3, x_date_format) into l_date3 from dual;
7861 AMS_Utility_PVT.Create_Log (
7862 x_return_status => l_return_status,
7863 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7864 p_log_used_by_id => p_import_list_header_id,
7865 p_msg_data => 'l_date3 = '||to_char(l_date3),
7866 p_msg_type => 'DEBUG'
7867 );
7868
7869 exception
7870 when others then
7871 l_col3 := 'Y';
7872 end;
7873 end if;
7874
7875 if p_column4 is not null then
7876 begin
7877 -- l_date4 := to_date(p_column4,'MM/DD/YYYY');
7878 select to_date(p_column4, x_date_format) into l_date4 from dual;
7879 AMS_Utility_PVT.Create_Log (
7880 x_return_status => l_return_status,
7881 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7882 p_log_used_by_id => p_import_list_header_id,
7883 p_msg_data => 'l_date4 = '||to_char(l_date4),
7884 p_msg_type => 'DEBUG'
7885 );
7886
7887 exception
7888 when others then
7889 l_col4 := 'Y';
7890 end;
7891 end if;
7892
7893
7894 if p_column5 is not null then
7895 begin
7896 -- l_date5 := to_date(p_column5,'MM/DD/YYYY');
7897 select to_date(p_column5, x_date_format) into l_date5 from dual;
7898 AMS_Utility_PVT.Create_Log (
7899 x_return_status => l_return_status,
7900 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7901 p_log_used_by_id => p_import_list_header_id,
7902 p_msg_data => 'l_date5 = '||to_char(l_date5),
7903 p_msg_type => 'DEBUG'
7904 );
7905 exception
7906 when others then
7907 l_col5 := 'Y';
7908 end;
7909 end if;
7910
7911 if p_column6 is not null then
7912 begin
7913 -- l_date6 := to_date(p_column6,'MM/DD/YYYY');
7914 select to_date(p_column6, x_date_format) into l_date6 from dual;
7915 AMS_Utility_PVT.Create_Log (
7916 x_return_status => l_return_status,
7917 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
7918 p_log_used_by_id => p_import_list_header_id,
7919 p_msg_data => 'l_date6 = '||to_char(l_date6),
7920 p_msg_type => 'DEBUG'
7921 );
7922 exception
7923 when others then
7924 l_col6 := 'Y';
7925 end;
7926 end if;
7927
7928 if l_imp_type = 'LEAD' then
7929 l_col11 := 'ASSIGN_DATE: ';
7930 l_col22 := 'ADDRESS_EFFECTIVE_DATE: ';
7931 l_col55 := 'LEAD_DATE: ';
7932 end if;
7933
7934 if (l_imp_type = 'B2B' or l_imp_type = 'B2C') then
7935 l_col11 := 'ADDRESS_EFFECTIVE_DATE : ';
7936 l_col22 := 'ADDRESS_EXPIRATION_DATE : ';
7937 l_col33 := 'DATE_OF_BIRTH : ';
7938 l_col44 := 'DATE_OF_DEATH : ';
7939 l_col55 := 'DEBARTMENTS_DATE : ';
7940 l_col66 := 'MARITAL_STATUS_EFFECTIVE_DATE : ';
7941 end if;
7942
7943 if (l_col1 = 'Y' or l_col2 = 'Y' or l_col3 = 'Y' or l_col4 = 'Y' or l_col5 = 'Y' or l_col6 = 'Y') then
7944 if l_error_exist = 'Y' then
7945 update ams_list_import_errors
7946 set col227 = decode(l_col1,'Y',l_col11||l_invalid_date),
7947 col228 = decode(l_col2,'Y',l_col22||l_invalid_date),
7948 -- col229 = decode(l_col3,'Y','LAST_ORDERED_DATE:'||l_invalid_date),
7949 -- col230 = decode(l_col4,'Y','PROGRAM_UPDATE_DATE:'||l_invalid_date),
7950 col233 = decode(l_col3,'Y',l_col33||l_invalid_date),
7951 col234 = decode(l_col4,'Y',l_col44||l_invalid_date),
7952 col235 = decode(l_col5,'Y',l_col55||l_invalid_date),
7953 col236 = decode(l_col6,'Y',l_col66||l_invalid_date)
7954 where import_list_header_id = p_import_list_header_id
7955 and import_source_line_id = p_import_source_line_id
7956 and batch_id = p_batch_id;
7957 end if;
7958 if l_file_type = 'XML' then
7959 if (l_imp_type in ('B2B','B2C') and (l_col1 = 'Y' or l_col2 = 'Y'))then
7960 update AMS_IMP_XML_ELEMENTS
7961 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col1,'Y',l_col11||l_invalid_date)||','||
7962 decode(l_col2,'Y',l_col22||l_invalid_date),
7963 LOAD_STATUS = 'ERROR'
7964 where imp_xml_element_id = l_add_imp_xml_element_id;
7965 end if;
7966 if (l_imp_type in ('B2B') and (l_col3 = 'Y' or l_col4 = 'Y' or l_col5 = 'Y' or l_col6 = 'Y'))then
7967 if l_col3 = 'Y' then
7968 update AMS_IMP_XML_ELEMENTS
7969 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col3,'Y',l_col33||l_invalid_date),
7970 LOAD_STATUS = 'ERROR'
7971 where imp_xml_element_id = l_ocont_imp_xml_element_id;
7972 end if;
7973 if l_col4 = 'Y' then
7974 update AMS_IMP_XML_ELEMENTS
7975 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col4,'Y',l_col44||l_invalid_date),
7976 LOAD_STATUS = 'ERROR'
7977 where imp_xml_element_id = l_ocont_imp_xml_element_id;
7978 end if;
7979 if l_col6 = 'Y' then
7980 update AMS_IMP_XML_ELEMENTS
7981 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col6,'Y',l_col66||l_invalid_date),
7982 LOAD_STATUS = 'ERROR'
7983 where imp_xml_element_id = l_ocont_imp_xml_element_id;
7984 end if;
7985 if l_col5 = 'Y' then
7986 update AMS_IMP_XML_ELEMENTS
7987 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col5,'Y',l_col55||l_invalid_date),
7988 LOAD_STATUS = 'ERROR'
7989 where imp_xml_element_id = l_org_imp_xml_element_id;
7990 end if;
7991 end if;
7992 if (l_imp_type in ('B2C') and (l_col3 = 'Y' or l_col4 = 'Y' or l_col6 = 'Y'))then
7993 if l_col3 = 'Y' then
7994 update AMS_IMP_XML_ELEMENTS
7995 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col3,'Y',l_col33||l_invalid_date),
7996 LOAD_STATUS = 'ERROR'
7997 where imp_xml_element_id = l_per_imp_xml_element_id;
7998 end if;
7999 if l_col4 = 'Y' then
8000 update AMS_IMP_XML_ELEMENTS
8001 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col4,'Y',l_col44||l_invalid_date),
8002 LOAD_STATUS = 'ERROR'
8003 where imp_xml_element_id = l_per_imp_xml_element_id;
8004 end if;
8005 if l_col6 = 'Y' then
8006 update AMS_IMP_XML_ELEMENTS
8007 set ERROR_TEXT = ERROR_TEXT ||','||decode(l_col6,'Y',l_col66||l_invalid_date),
8008 LOAD_STATUS = 'ERROR'
8009 where imp_xml_element_id = l_per_imp_xml_element_id;
8010 end if;
8011 end if;
8012
8013 end if;
8014 end if;
8015 if l_error_exist is null then
8016 if (l_col1 = 'Y' or l_col2 = 'Y' or l_col3 = 'Y' or l_col4 = 'Y' or l_col5 = 'Y' or l_col6 = 'Y') then
8017 INSERT INTO ams_list_import_errors
8018 (
8019 LIST_IMPORT_ERROR_ID,
8020 LAST_UPDATED_BY,
8021 LAST_UPDATE_DATE,
8022 CREATION_DATE,
8023 CREATED_BY,
8024 LAST_UPDATE_LOGIN,
8025 IMPORT_SOURCE_LINE_ID,
8026 IMPORT_LIST_HEADER_ID,
8027 IMPORT_TYPE,
8028 ERROR_TYPE,
8029 BATCH_ID,
8030 col227,
8031 col228,
8032 -- col229,
8033 -- col230,
8034 col233,
8035 col234,
8036 col235,
8037 col236
8038 )
8039 VALUES
8040 (
8041 ams_list_import_errors_s.nextval, -- LIST_IMPORT_ERROR_ID,
8042 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
8043 SYSDATE, -- LAST_UPDATE_DATE,
8044 SYSDATE, -- CREATION_DATE,
8045 FND_GLOBAL.User_ID, -- CREATED_BY,
8046 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
8047 p_import_source_line_id,
8048 p_import_list_header_id,
8049 'LEAD', -- IMPORT_TYPE,
8050 'E', -- ERROR_TYPE,
8051 p_batch_id,
8052 decode(l_col1,'Y',l_col11||l_invalid_date),
8053 decode(l_col2,'Y',l_col22||l_invalid_date),
8054 -- decode(l_col3,'Y','LAST_ORDERED_DATE:'||l_invalid_date),
8055 -- decode(l_col4,'Y','PROGRAM_UPDATE_DATE:'||l_invalid_date),
8056 -- decode(l_col5,'Y','LEAD_DATE:'||l_invalid_date)
8057 decode(l_col3,'Y',l_col33||l_invalid_date),
8058 decode(l_col4,'Y',l_col44||l_invalid_date),
8059 decode(l_col5,'Y',l_col55||l_invalid_date),
8060 decode(l_col6,'Y',l_col66||l_invalid_date)
8061 );
8062 end if;
8063 end if;
8064 EXCEPTION
8065 WHEN OTHERS THEN
8066 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
8067 FND_MESSAGE.Set_Token('ROW','Error in date_validate:' || SQLERRM||' '||SQLCODE);
8068 AMS_Utility_PVT.Create_Log (
8069 x_return_status => l_return_status,
8070 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
8071 p_log_used_by_id => p_import_list_header_id,
8072 p_msg_data => FND_MESSAGE.get,
8073 p_msg_type => 'DEBUG'
8074 );
8075
8076 end date_validate;
8077
8078
8079 -- ---------------------------------------
8080 -- sranka 3/6/2003
8081 -- Using for support of "EMPLOYEE_OF"
8082 PROCEDURE execute_reltnship_validation (
8083 p_import_list_header_id NUMBER,
8084 p_return_status OUT NOCOPY VARCHAR2
8085 ) IS
8086
8087 --TYPE l_batch_id IS TABLE OF AMS_IMP_SOURCE_LINES.BATCH_ID%TYPE;
8088 TYPE l_imp_list_header_id IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_LIST_HEADER_ID%TYPE;
8089 TYPE l_imp_source_line_id IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
8090 TYPE l_relationship_type IS TABLE OF AMS_IMP_SOURCE_LINES.COL69%TYPE;
8091 TYPE l_relationship_code IS TABLE OF AMS_IMP_SOURCE_LINES.COL70%TYPE;
8092 TYPE l_import_failure_reason IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_FAILURE_REASON%TYPE;
8093
8094 l_last_fetch BOOLEAN := FALSE;
8095 l_limit_rows number := 1000;
8096
8097
8098 L_MAX_ROW_COUNT CONSTANT NUMBER := 1000;
8099 l_batch_id NUMBER;
8100 l_BEST_TIME_CONTACT_END varchar2(150);
8101 l_BEST_TIME_CONTACT_BEGIN varchar2(150);
8102 l_last_ordered_date varchar2(150);
8103 x_import_list_header_id number;
8104 x_import_source_line_id number;
8105 l_invalid_number varchar2(4000) ;
8106 l_invalid_value varchar2(4000) ;
8107 l_null_value varchar2(4000) ;
8108 x_b2b varchar(1);
8109 l_return_status varchar(1);
8110
8111
8112 CURSOR c_lead_batch_id is
8113 SELECT
8114 batch_id
8115 FROM ams_imp_list_headers_all
8116 WHERE import_list_header_id = p_import_list_header_id;
8117
8118 CURSOR c_as_list_headers is
8119 SELECT
8120 -- BATCH_ID,
8121 IMPORT_SOURCE_LINE_ID,
8122 IMPORT_LIST_HEADER_ID,
8123 RELATIONSHIP_CODE,
8124 RELATIONSHIP_TYPE,
8125 l_invalid_value
8126 FROM
8127 AMS_HZ_B2B_MAPPING_V B2B
8128 WHERE
8129 IMPORT_LIST_HEADER_ID=p_import_list_header_id and
8130 ( PERSON_FIRST_NAME IS NOT NULL OR PERSON_LAST_NAME IS NOT NULL )
8131 AND (( RELATIONSHIP_CODE is not null
8132 AND RELATIONSHIP_TYPE is not null )
8133 OR(RELATIONSHIP_CODE is null
8134 AND RELATIONSHIP_TYPE is not null
8135 )
8136 OR(RELATIONSHIP_CODE is not null
8137 AND RELATIONSHIP_TYPE is null
8138 )
8139 )
8140 AND (nvl(RELATIONSHIP_CODE,'DUMMY')
8141 not IN ( SELECT
8142 b.FORWARD_REL_CODE
8143 FROM
8144 HZ_CODE_ASSIGNMENTS a,
8145 HZ_RELATIONSHIP_TYPES b
8146 WHERE
8147 a.owner_table_name = 'HZ_RELATIONSHIP_TYPES' and
8148 a.owner_table_id = b.RELATIONSHIP_TYPE_ID and
8149 a.class_code= 'PARTY_REL_GRP_CONTACTS' and
8150 b.subject_type = 'PERSON' and
8151 b.object_type = 'ORGANIZATION' and
8152 b.DIRECTION_CODE = 'P'and
8153 -- B2B.RELATIONSHIP_CODE = b.FORWARD_REL_CODE
8154 B2B.RELATIONSHIP_TYPE = b.RELATIONSHIP_TYPE
8155 )
8156 --OR RELATIONSHIP_TYPE
8157 -- not IN ( SELECT
8158 -- b.RELATIONSHIP_TYPE
8159 -- FROM
8160 -- HZ_CODE_ASSIGNMENTS a,
8161 -- HZ_RELATIONSHIP_TYPES b
8162 -- WHERE
8163 -- a.owner_table_name = 'HZ_RELATIONSHIP_TYPES' and
8164 -- a.owner_table_id = b.RELATIONSHIP_TYPE_ID and
8165 -- a.class_code= 'PARTY_REL_GRP_CONTACTS' and
8166 -- b.subject_type = 'PERSON' and
8167 -- b.object_type = 'ORGANIZATION' and
8168 -- b.DIRECTION_CODE = 'P'and
8169 -- B2B.RELATIONSHIP_TYPE = b.RELATIONSHIP_TYPE
8170 -- )
8171
8172 );
8173
8174 --I_batch_id l_batch_id;
8175 I_imp_source_line_id l_imp_source_line_id;
8176 I_imp_list_header_id l_imp_list_header_id;
8177 I_relationship_type l_relationship_type;
8178 I_relationship_code l_relationship_code;
8179 I_import_failure_reason l_import_failure_reason;
8180
8181
8182
8183 BEGIN
8184
8185
8186 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_INVALID_VAL');
8187 l_invalid_value := 'RELATIONSHIP_TYPE :: RELATIONSHIP_CODE :: ' || FND_MESSAGE.get;
8188
8189
8190
8191 OPEN c_lead_batch_id;
8192 FETCH c_lead_batch_id into l_batch_id;
8193 CLOSE c_lead_batch_id;
8194
8195
8196 open c_as_list_headers;
8197 LOOP
8198 fetch c_as_list_headers BULK COLLECT into
8199 -- I_batch_id,
8200 I_imp_source_line_id,
8201 I_imp_list_header_id,
8202 I_relationship_type,
8203 I_relationship_code,
8204 I_import_failure_reason LIMIT l_limit_rows;
8205
8206
8207
8208 IF c_as_list_headers%NOTFOUND THEN
8209
8210 l_last_fetch := TRUE;
8211 END IF;
8212
8213 IF I_imp_source_line_id.COUNT = 0 AND l_last_fetch THEN
8214 EXIT;
8215 END IF;
8216
8217
8218 FORALL i IN I_imp_source_line_id.FIRST..I_imp_source_line_id.LAST
8219 INSERT INTO ams_list_import_errors
8220 (
8221 LIST_IMPORT_ERROR_ID,
8222 LAST_UPDATED_BY,
8223 LAST_UPDATE_DATE,
8224 CREATION_DATE,
8225 CREATED_BY,
8226 LAST_UPDATE_LOGIN,
8227 ERROR_TYPE,
8228 BATCH_ID,
8229 IMPORT_LIST_HEADER_ID,
8230 IMPORT_SOURCE_LINE_ID,
8231 COL1
8232 )
8233 values
8234 (
8235 ams_list_import_errors_s.nextval, -- LIST_IMPORT_ERROR_ID,
8236 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
8237 SYSDATE, -- LAST_UPDATE_DATE,
8238 SYSDATE, -- CREATION_DATE,
8239 FND_GLOBAL.User_ID, -- CREATED_BY,
8240 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
8241 'E',
8242 l_batch_id,
8243 I_imp_list_header_id(i),
8244 I_imp_source_line_id(i),
8245 I_import_failure_reason(i)
8246 );
8247 COMMIT;
8248 --
8249 IF l_last_fetch = TRUE THEN
8250 EXIT;
8251 END IF;
8252
8253 END LOOP;
8254 CLOSE c_as_list_headers;
8255
8256
8257
8258 UPDATE ams_imp_source_lines
8259 SET load_status = 'ERROR'
8260 WHERE import_list_header_id = p_import_list_header_id
8261 and import_source_line_id in
8262 (select import_source_line_id from ams_list_import_errors
8263 where import_list_header_id = p_import_list_header_id
8264 and error_type = 'E');
8265
8266
8267 EXCEPTION
8268 WHEN OTHERS THEN
8269 p_return_status := FND_API.G_RET_STS_ERROR;
8270 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
8271 FND_MESSAGE.Set_Token('ROW','Error in execute_relationship_validation:' || SQLERRM||' '||SQLCODE);
8272 AMS_Utility_PVT.Create_Log (
8273 x_return_status => l_return_status,
8274 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
8275 p_log_used_by_id => p_import_list_header_id,
8276 p_msg_data => FND_MESSAGE.get,
8277 p_msg_type => 'DEBUG'
8278 );
8279
8280 end execute_reltnship_validation;
8281
8282
8283
8284
8285
8286
8287 PROCEDURE execute_cust_data_validation (
8288 p_import_list_header_id NUMBER,
8289 p_return_status OUT NOCOPY VARCHAR2
8290 ) IS
8291
8292 TYPE num_data_set_type_w IS
8293 TABLE OF NUMBER INDEX BY BINARY_INTEGER;
8294
8295 TYPE varchar2_250_set_type IS
8296 TABLE OF VARCHAR2(250) INDEX BY BINARY_INTEGER;
8297
8298 L_MAX_ROW_COUNT CONSTANT NUMBER := 1000;
8299 l_batch_id NUMBER;
8300 l_ADDRESS_EFFECTIVE_DATE varchar2(150);
8301 l_ADDRESS_EXPIRATION_DATE varchar2(150);
8302 l_DATE_OF_BIRTH varchar2(150);
8303 l_DATE_OF_DEATH varchar2(150);
8304 l_DEBARTMENTS_DATE varchar2(150);
8305 l_MARITAL_STATUS_EFF_DATE varchar2(150);
8306 l_last_ordered_date varchar2(150);
8307 x_import_list_header_id number;
8308 x_import_source_line_id number;
8309 l_invalid_number varchar2(4000) ;
8310 l_invalid_size varchar2(4000) ;
8311 l_null_value varchar2(4000) ;
8312 x_b2b varchar(30);
8313 l_return_status varchar(1);
8314 l_imp_type varchar2(60);
8315
8316
8317 l_import_source_line_id num_data_set_type_w;
8318 l_import_list_header_id num_data_set_type_w;
8319
8320 l_col1 varchar2_250_set_type;
8321 l_col2 varchar2_250_set_type;
8322 l_col3 varchar2_250_set_type;
8323 l_col4 varchar2_250_set_type;
8324 l_col5 varchar2_250_set_type;
8325 l_col6 varchar2_250_set_type;
8326 l_col7 varchar2_250_set_type;
8327 l_col8 varchar2_250_set_type;
8328 l_col9 varchar2_250_set_type;
8329 l_col10 varchar2_250_set_type;
8330 l_col11 varchar2_250_set_type;
8331 l_col12 varchar2_250_set_type;
8332 l_col13 varchar2_250_set_type;
8333 l_col14 varchar2_250_set_type;
8334 l_col15 varchar2_250_set_type;
8335 l_col16 varchar2_250_set_type;
8336 l_col17 varchar2_250_set_type;
8337 l_col18 varchar2_250_set_type;
8338 l_col19 varchar2_250_set_type;
8339 l_col20 varchar2_250_set_type;
8340 l_col21 varchar2_250_set_type;
8341 l_col22 varchar2_250_set_type;
8342 l_col23 varchar2_250_set_type;
8343 l_col24 varchar2_250_set_type;
8344 l_col25 varchar2_250_set_type;
8345 l_col26 varchar2_250_set_type;
8346 l_col27 varchar2_250_set_type;
8347 l_col28 varchar2_250_set_type;
8348 l_col29 varchar2_250_set_type;
8349 l_col30 varchar2_250_set_type;
8350 l_col31 varchar2_250_set_type;
8351 l_col32 varchar2_250_set_type;
8352 l_col33 varchar2_250_set_type;
8353 l_col34 varchar2_250_set_type;
8354 l_col35 varchar2_250_set_type;
8355 l_col36 varchar2_250_set_type;
8356 l_col37 varchar2_250_set_type;
8357 l_col38 varchar2_250_set_type;
8358 l_col39 varchar2_250_set_type;
8359 l_col40 varchar2_250_set_type;
8360 l_col41 varchar2_250_set_type;
8361 l_col42 varchar2_250_set_type;
8362 l_col43 varchar2_250_set_type;
8363 l_col44 varchar2_250_set_type;
8364 l_col45 varchar2_250_set_type;
8365 l_col46 varchar2_250_set_type;
8366 l_col47 varchar2_250_set_type;
8367 l_col48 varchar2_250_set_type;
8368 l_col49 varchar2_250_set_type;
8369 l_col50 varchar2_250_set_type;
8370 l_col51 varchar2_250_set_type;
8371 l_col52 varchar2_250_set_type;
8372 l_col53 varchar2_250_set_type;
8373 l_col54 varchar2_250_set_type;
8374 l_col55 varchar2_250_set_type;
8375 l_col56 varchar2_250_set_type;
8376 l_col57 varchar2_250_set_type;
8377 l_col58 varchar2_250_set_type;
8378 l_col59 varchar2_250_set_type;
8379 l_col60 varchar2_250_set_type;
8380 l_col61 varchar2_250_set_type;
8381 l_col62 varchar2_250_set_type;
8382 l_col63 varchar2_250_set_type;
8383 l_col64 varchar2_250_set_type;
8384 l_col65 varchar2_250_set_type;
8385 l_col66 varchar2_250_set_type;
8386 l_col67 varchar2_250_set_type;
8387 l_col68 varchar2_250_set_type;
8388 l_col69 varchar2_250_set_type;
8389 l_col70 varchar2_250_set_type;
8390 l_col71 varchar2_250_set_type;
8391 l_col72 varchar2_250_set_type;
8392 l_col73 varchar2_250_set_type;
8393 l_col74 varchar2_250_set_type;
8394 l_col75 varchar2_250_set_type;
8395 l_col76 varchar2_250_set_type;
8396 l_col77 varchar2_250_set_type;
8397 l_col78 varchar2_250_set_type;
8398 l_col79 varchar2_250_set_type;
8399 l_col80 varchar2_250_set_type;
8400 l_col81 varchar2_250_set_type;
8401 l_col82 varchar2_250_set_type;
8402 l_col83 varchar2_250_set_type;
8403 l_col84 varchar2_250_set_type;
8404 l_col85 varchar2_250_set_type;
8405 l_col86 varchar2_250_set_type;
8406 l_col87 varchar2_250_set_type;
8407 l_col88 varchar2_250_set_type;
8408 l_col89 varchar2_250_set_type;
8409 l_col90 varchar2_250_set_type;
8410 l_col91 varchar2_250_set_type;
8411 l_col92 varchar2_250_set_type;
8412 l_col93 varchar2_250_set_type;
8413 l_col94 varchar2_250_set_type;
8414 l_col95 varchar2_250_set_type;
8415 l_col96 varchar2_250_set_type;
8416 l_col97 varchar2_250_set_type;
8417 l_col98 varchar2_250_set_type;
8418 l_col99 varchar2_250_set_type;
8419 l_col100 varchar2_250_set_type;
8420 l_col101 varchar2_250_set_type;
8421 l_col102 varchar2_250_set_type;
8422 l_col103 varchar2_250_set_type;
8423 l_col104 varchar2_250_set_type;
8424 l_col105 varchar2_250_set_type;
8425 l_col106 varchar2_250_set_type;
8426 l_col107 varchar2_250_set_type;
8427 l_col108 varchar2_250_set_type;
8428 l_col109 varchar2_250_set_type;
8429 l_col110 varchar2_250_set_type;
8430 l_col111 varchar2_250_set_type;
8431 l_col112 varchar2_250_set_type;
8432 l_col113 varchar2_250_set_type;
8433 l_col114 varchar2_250_set_type;
8434 l_col115 varchar2_250_set_type;
8435 l_col116 varchar2_250_set_type;
8436 l_col117 varchar2_250_set_type;
8437 l_col118 varchar2_250_set_type;
8438 l_col119 varchar2_250_set_type;
8439 l_col120 varchar2_250_set_type;
8440 l_col121 varchar2_250_set_type;
8441 l_col122 varchar2_250_set_type;
8442 l_col123 varchar2_250_set_type;
8443 l_col124 varchar2_250_set_type;
8444 l_col125 varchar2_250_set_type;
8445 l_col126 varchar2_250_set_type;
8446 l_col127 varchar2_250_set_type;
8447 l_col128 varchar2_250_set_type;
8448 l_col129 varchar2_250_set_type;
8449 l_col130 varchar2_250_set_type;
8450 l_col131 varchar2_250_set_type;
8451 l_col132 varchar2_250_set_type;
8452 l_col133 varchar2_250_set_type;
8453 l_col134 varchar2_250_set_type;
8454 l_col135 varchar2_250_set_type;
8455 l_col136 varchar2_250_set_type;
8456 l_col137 varchar2_250_set_type;
8457 l_col138 varchar2_250_set_type;
8458 l_col139 varchar2_250_set_type;
8459 l_col140 varchar2_250_set_type;
8460 l_col141 varchar2_250_set_type;
8461 l_col142 varchar2_250_set_type;
8462 l_col143 varchar2_250_set_type;
8463 l_col144 varchar2_250_set_type;
8464 l_col145 varchar2_250_set_type;
8465 l_col146 varchar2_250_set_type;
8466 l_col147 varchar2_250_set_type;
8467 l_col148 varchar2_250_set_type;
8468 l_col149 varchar2_250_set_type;
8469 l_col150 varchar2_250_set_type;
8470 l_col151 varchar2_250_set_type;
8471 l_col152 varchar2_250_set_type;
8472 l_col153 varchar2_250_set_type;
8473 l_col154 varchar2_250_set_type;
8474 l_col155 varchar2_250_set_type;
8475 l_col156 varchar2_250_set_type;
8476 l_col157 varchar2_250_set_type;
8477 l_col158 varchar2_250_set_type;
8478 l_col159 varchar2_250_set_type;
8479 l_col160 varchar2_250_set_type;
8480 l_col161 varchar2_250_set_type;
8481 l_col162 varchar2_250_set_type;
8482 l_col163 varchar2_250_set_type;
8483 l_col164 varchar2_250_set_type;
8484 l_col165 varchar2_250_set_type;
8485 l_col166 varchar2_250_set_type;
8486 l_col167 varchar2_250_set_type;
8487 l_col168 varchar2_250_set_type;
8488 l_col169 varchar2_250_set_type;
8489 l_col170 varchar2_250_set_type;
8490 l_col171 varchar2_250_set_type;
8491 l_col172 varchar2_250_set_type;
8492 l_col173 varchar2_250_set_type;
8493 l_col174 varchar2_250_set_type;
8494 l_col175 varchar2_250_set_type;
8495 l_col176 varchar2_250_set_type;
8496 l_col177 varchar2_250_set_type;
8497 l_col178 varchar2_250_set_type;
8498 l_col179 varchar2_250_set_type;
8499 l_col180 varchar2_250_set_type;
8500 l_col181 varchar2_250_set_type;
8501 l_col182 varchar2_250_set_type;
8502 l_col183 varchar2_250_set_type;
8503 l_col184 varchar2_250_set_type;
8504 l_col185 varchar2_250_set_type;
8505 l_col186 varchar2_250_set_type;
8506 l_col187 varchar2_250_set_type;
8507 l_col188 varchar2_250_set_type;
8508 l_col189 varchar2_250_set_type;
8509 l_col190 varchar2_250_set_type;
8510 l_col191 varchar2_250_set_type;
8511 l_col192 varchar2_250_set_type;
8512 l_col193 varchar2_250_set_type;
8513 l_col194 varchar2_250_set_type;
8514 l_col195 varchar2_250_set_type;
8515 l_col196 varchar2_250_set_type;
8516 l_col197 varchar2_250_set_type;
8517 l_col198 varchar2_250_set_type;
8518 l_col199 varchar2_250_set_type;
8519 l_col200 varchar2_250_set_type;
8520 l_col201 varchar2_250_set_type;
8521 -- sranka modiefied for COLT Enhacement 7/15/2003
8522 l_col221 varchar2_250_set_type;
8523 l_col222 varchar2_250_set_type;
8524 l_col223 varchar2_250_set_type;
8525 l_col224 varchar2_250_set_type;
8526 l_col225 varchar2_250_set_type;
8527 l_col226 varchar2_250_set_type;
8528 l_col227 varchar2_250_set_type;
8529 l_col228 varchar2_250_set_type;
8530 l_col229 varchar2_250_set_type;
8531 l_col230 varchar2_250_set_type;
8532 l_col231 varchar2_250_set_type;
8533 l_col232 varchar2_250_set_type;
8534 l_col233 varchar2_250_set_type;
8535 l_col234 varchar2_250_set_type;
8536 l_col235 varchar2_250_set_type;
8537 l_col236 varchar2_250_set_type;
8538 l_col237 varchar2_250_set_type;
8539 l_col238 varchar2_250_set_type;
8540 l_col239 varchar2_250_set_type;
8541 l_col240 varchar2_250_set_type;
8542 l_col241 varchar2_250_set_type;
8543 l_col242 varchar2_250_set_type;
8544 l_col243 varchar2_250_set_type;
8545 l_col244 varchar2_250_set_type;
8546 l_col245 varchar2_250_set_type;
8547 l_col246 varchar2_250_set_type;
8548 l_col247 varchar2_250_set_type;
8549 l_col248 varchar2_250_set_type;
8550 l_col249 varchar2_250_set_type;
8551 l_col251 varchar2_250_set_type;
8552 l_col252 varchar2_250_set_type;
8553 l_col253 varchar2_250_set_type;
8554 l_col254 varchar2_250_set_type;
8555 l_col255 varchar2_250_set_type;
8556 l_col256 varchar2_250_set_type;
8557 l_col257 varchar2_250_set_type;
8558 l_col258 varchar2_250_set_type;
8559 l_col259 varchar2_250_set_type;
8560 l_col260 varchar2_250_set_type;
8561 l_col261 varchar2_250_set_type;
8562 l_col262 varchar2_250_set_type;
8563 l_col263 varchar2_250_set_type;
8564 l_col264 varchar2_250_set_type;
8565 l_col265 varchar2_250_set_type;
8566 l_col266 varchar2_250_set_type;
8567 l_col267 varchar2_250_set_type;
8568 l_col268 varchar2_250_set_type;
8569 l_col269 varchar2_250_set_type;
8570 l_col270 varchar2_250_set_type;
8571 l_col271 varchar2_250_set_type;
8572 l_col272 varchar2_250_set_type;
8573 l_col273 varchar2_250_set_type;
8574 l_col274 varchar2_250_set_type;
8575 l_col275 varchar2_250_set_type;
8576 l_col276 varchar2_250_set_type;
8577 l_col277 varchar2_250_set_type;
8578 l_col278 varchar2_250_set_type;
8579 l_col279 varchar2_250_set_type;
8580 l_col280 varchar2_250_set_type;
8581 l_col281 varchar2_250_set_type;
8582 l_col282 varchar2_250_set_type;
8583 l_col283 varchar2_250_set_type;
8584 l_col284 varchar2_250_set_type;
8585 l_col285 varchar2_250_set_type;
8586 l_col286 varchar2_250_set_type;
8587 l_col287 varchar2_250_set_type;
8588 l_col288 varchar2_250_set_type;
8589 l_col289 varchar2_250_set_type;
8590 l_col290 varchar2_250_set_type;
8591 l_col291 varchar2_250_set_type;
8592 l_col292 varchar2_250_set_type;
8593 l_col293 varchar2_250_set_type;
8594 l_col294 varchar2_250_set_type;
8595 l_col295 varchar2_250_set_type;
8596 l_col296 varchar2_250_set_type;
8597 l_col297 varchar2_250_set_type;
8598 l_col298 varchar2_250_set_type;
8599 l_col299 varchar2_250_set_type;
8600 l_col300 varchar2_250_set_type;
8601 l_col301 varchar2_250_set_type;
8602 l_col302 varchar2_250_set_type;
8603
8604 CURSOR c_lead_batch_id is
8605 SELECT
8606 batch_id
8607 FROM ams_imp_list_headers_all
8608 WHERE import_list_header_id = p_import_list_header_id;
8609
8610 -- Cursor for B2B party type
8611
8612 cursor b2b is
8613 SELECT
8614 IMPORT_SOURCE_LINE_ID,
8615 import_list_header_id,
8616 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PARTY_NAME))),255) - 255,0,' ','PARTY_NAME :'||decode(nvl(PARTY_NAME,'x'),'x',l_null_value,l_invalid_size)||'(255)') PARTY_NAME,
8617 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FISCAL_YEAREND_MONTH)),'x')),30) - 30,0,' ','FISCAL_YEAREND_MONTH :'||l_invalid_size||'(30)') FISCAL_YEAREND_MONTH,
8618 /*
8619 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DUNS_NUMBER,' ','x'))),'0123456789.', 'x'))),0),0,' ','DUNS_NUMBER :'||l_invalid_number) DUNS_NUMBER,
8620 */
8621 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DUNS_NUMBER)),'x')),30) - 30,0,' ','DUNS_NUMBER:'||l_invalid_size||'(30)') DUNS_NUMBER,
8622 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(EMPLOYEES_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,' ','EMPLOYEES_TOTAL :'||l_invalid_number) EMPLOYEES_TOTAL,
8623 DECODE(GREATEST(lengthb(nvl(LINE_OF_BUSINESS,'x')),240) - 240,0,' ','LINE_OF_BUSINESS :'||l_invalid_size) LINE_OF_BUSINESS,
8624 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,' ','ADDRESS1 :'||l_invalid_size||'(240)') ADDRESS1,
8625 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,' ','ADDRESS2 :'||l_invalid_size||'(240)') ADDRESS2,
8626 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,' ','ADDRESS3 :'||l_invalid_size||'(240)') ADDRESS3,
8627 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,' ','ADDRESS4 :'||l_invalid_size||'(240)') ADDRESS4,
8628 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(YEAR_ESTABLISHED,' ','x'))),'0123456789.',' x'))),0),0,' ','YEAR_ESTABLISHED :'||l_invalid_number) YEAR_ESTABLISHED,
8629 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),50) - 50,0,' ','TAX_REFERENCE :'||l_invalid_size||'(50)') TAX_REFERENCE,
8630 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CEO_NAME)),'x')),240) - 240,0,' ','CEO_NAME :'||l_invalid_size||'(240)') CEO_NAME,
8631 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME)),'x')),50) - 50,0,' ','PERSON_LAST_NAME :'||l_invalid_size||'(50)') PERSON_LAST_NAME,
8632 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME)),'x')),40) - 40,0,' ','PERSON_FIRST_NAME :'||l_invalid_size||'(40)') PERSON_FIRST_NAME,
8633 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,' ','PERSON_NAME_PREFIX :'||l_invalid_size||'(30)') PERSON_NAME_PREFIX,
8634 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE)),'x')),100) - 100,0,' ','JOB_TITLE :'||l_invalid_size||'(100)') JOB_TITLE,
8635 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,' ','PERSON_MIDDLE_NAME :'||l_invalid_size||'(60)') PERSON_MIDDLE_NAME,
8636 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,' ','PERSON_NAME_SUFFIX :'||l_invalid_size||'(30)') PERSON_NAME_SUFFIX,
8637 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,' ','CITY :'||l_invalid_size||'(60)') CITY ,
8638 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,' ','POSTAL_CODE :'||l_invalid_size||'(60)') POSTAL_CODE,
8639 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,' ','STATE :'||l_invalid_size||'(60)') STATE,
8640 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,' ','PROVINCE :'||l_invalid_size||'(60)') PROVINCE,
8641 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,' ','COUNTY :'||l_invalid_size||'(60)') COUNTY,
8642 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,' ','COUNTRY :'||l_invalid_size||'(60)') COUNTRY,
8643 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,' ','TIME_ZONE :'||l_invalid_size||'(50)') TIME_ZONE,
8644 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,' ','EMAIL_ADDRESS :'||l_invalid_size||'(240)') EMAIL_ADDRESS,
8645 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,' ','PHONE_COUNTRY_CODE :'||l_invalid_size||'(30)') PHONE_COUNTRY_CODE,
8646 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,' ','PHONE_AREA_CODE :'||l_invalid_size||'(10)') PHONE_AREA_CODE,
8647 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,' ','PHONE_NUMBER :'||l_invalid_size||'(25)') PHONE_NUMBER,
8648 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,' ','PHONE_EXTENTION :'||l_invalid_size||'(20)') PHONE_EXTENTION,
8649 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT)),'x')),60) - 60,0,' ','DEPARTMENT :'||l_invalid_size||'(60)') DEPARTMENT,
8650 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,' ','DECISION_MAKER_FLAG :'||l_invalid_size||'(1)') DECISION_MAKER_FLAG,
8651 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE)),'x')),30) - 30,0,' ','SIC_CODE :'||l_invalid_size||'(30)') SIC_CODE,
8652 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE_TYPE)),'x')),30) - 30,0,' ','SIC_CODE_TYPE :'||l_invalid_size||'(30)') SIC_CODE_TYPE,
8653 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_NUM_OF_ORDERS,' ','x'))),'0123456789.',' x'))),0),0,' ','TOTAL_NUM_OF_ORDERS :'||l_invalid_number) TOTAL_NUM_OF_ORDERS,
8654 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_ORDERED_AMOUNT,' ','x'))),'0123456789.',' x'))),0),0,' ','TOTAL_ORDERED_AMOUNT :'||l_invalid_number) TOTAL_ORDERED_AMOUNT,
8655 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ANALYSIS_FY)),'x')),5) - 5,0,' ','ANALYSIS_FY :'||l_invalid_size||'(5)') ANALYSIS_FY,
8656 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CURR_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,' ','CURR_FY_POTENTIAL_REVENUE :'||l_invalid_number) CURR_FY_POTENTIAL_REVENUE,
8657 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(NEXT_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,' ','NEXT_FY_POTENTIAL_REVENUE :'||l_invalid_number) NEXT_FY_POTENTIAL_REVENUE,
8658 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GSA_INDICATOR_FLAG)),'x')),1) - 1,0,' ','GSA_INDICATOR_FLAG :'||l_invalid_size||'(1)') GSA_INDICATOR_FLAG,
8659 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OVERSEAS_ADDRESS_FLAG)),'x')),1) - 1,0,' ','OVERSEAS_ADDRESS_FLAG :'||l_invalid_size||'(1)') OVERSEAS_ADDRESS_FLAG,
8660 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,' ','identifying_address_flag :'||l_invalid_size||'(1)') identifying_address_flag,
8661 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(APARTMENT_FLAG)),'x')),1) - 1,0,' ','APARTMENT_FLAG :'||l_invalid_size||'(1)') APARTMENT_FLAG,
8662 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MISSION_STATEMENT)),'x')),2000) - 2000,0,' ','MISSION_STATEMENT :'||l_invalid_size||'(2000)') MISSION_STATEMENT,
8663 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_NAME_PHONETIC)),'x')),320) - 320,0,' ','ORGANIZATION_NAME_PHONETIC :'||l_invalid_size||'(320)') ORGANIZATION_NAME_PHONETIC,
8664 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CATEGORY_CODE)),'x')),30) -30,0,' ','CATEGORY_CODE:'||l_invalid_size||'(30)') CATEGORY_CODE,
8665 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JGZZ_FISCAL_CODE)),'x')),20) - 20,0,' ','JGZZ_FISCAL_CODE :'||l_invalid_size||'(20)') JGZZ_FISCAL_CODE,
8666 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_NAME)),'x')),60) - 60,0,' ','TAX_NAME :'||l_invalid_size||'(60)') TAX_NAME,
8667 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,' ','ADDRESS_LINES_PHONETIC :'||l_invalid_size||'(560)') ADDRESS_LINES_PHONETIC,
8668 -- bug 4641591: columns obsolete
8669 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,' ','PO_BOX_NUMBER :'||l_invalid_size||'(50)') PO_BOX_NUMBER,
8670 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,' ','FLOOR :'||l_invalid_size||'(50)') FLOOR,
8671 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,' ','HOUSE_NUMBER :'||l_invalid_size||'(50)') HOUSE_NUMBER,
8672 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),10) - 10,0,' ','POSTAL_PLUS4_CODE :'||l_invalid_size||'(10)') POSTAL_PLUS4_CODE,
8673 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,' ','STREET_SUFFIX :'||l_invalid_size||'(50)') STREET_SUFFIX,
8674 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECONDARY_SUFFIX_ELENENT)),'x')),240) - 240,0,' ','SECONDARY_SUFFIX_ELENENT :'||l_invalid_size||'(240)') SECONDARY_SUFFIX_ELENENT,
8675 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,' ','STREET :'||l_invalid_size||'(50)') STREET,
8676 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,' ','STREET_NUMBER :'||l_invalid_size||'(50)') STREET_NUMBER,
8677 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SUITE)),'x')),50) - 50,0,' ','SUITE :'||l_invalid_size||'(50)') SUITE,
8678 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_TYPE)),'x')),50) - 50,0,' ','RURAL_ROUTE_TYPE :'||l_invalid_size||'(50)') RURAL_ROUTE_TYPE,
8679 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_NUMBER)),'x')),50) - 50,0,' ','RURAL_ROUTE_NUMBER :'||l_invalid_size||'(50)') RURAL_ROUTE_NUMBER,
8680 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,' ','PARTY_ID :'||l_invalid_number) party_id,
8681 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_URL)),'x')),2000) - 2000,0,' ','ORGANIZATION_URL :'||l_invalid_size||'(2000)') ORGANIZATION_URL,
8682 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BRANCH_FLAG)),'x')),1) - 1,0,' ','BRANCH_FLAG :'||l_invalid_size||'(1)') BRANCH_FLAG,
8683 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_LINE)),'x')),240) - 240,0,' ','BUSINESS_LINE :'||l_invalid_size||'(240)') BUSINESS_LINE,
8684 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_SCOPE)),'x')),20) - 20,0,' ','BUSINESS_SCOPE :'||l_invalid_size||'(20)') BUSINESS_SCOPE,
8685 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CHIEF_EXECUTIVE_TITLE)),'x')),240) - 240,0,' ','CHIEF_EXECUTIVE_TITLE :'||l_invalid_size||'(240)') CHIEF_EXECUTIVE_TITLE,
8686 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONGRESSIONAL_DISTRICT_CODE)),'x')),2) - 2,0,' ','CONGRESSIONAL_DISTRICT_CODE :'||l_invalid_size||'(2)') CONGRESSIONAL_DISTRICT_CODE,
8687 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CORPORATION_CLASS)),'x')),60) - 60,0,' ','CORPORATION_CLASS :'||l_invalid_size||'(60)') CORPORATION_CLASS,
8688 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE)),'x')),30) - 30,0,' ','CREDIT_SCORE :'||l_invalid_size||'(30)') CREDIT_SCORE,
8689 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE_COMMENTARY)),'x')),30) - 30,0,' ','CREDIT_SCORE_COMMENTARY :'||l_invalid_size||'(30)') CREDIT_SCORE_COMMENTARY,
8690 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DB_RATING)),'x')),5) - 5,0,' ','DB_RATING :'||l_invalid_size||'(5)') DB_RATING,
8691 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,' ','DECLARED_ETHNICITY :'||l_invalid_size||'(60)') DECLARED_ETHNICITY,
8692 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT_INDICATOR)),'x')),30) - 30,0,' ','DEPARTMENT_INDICATOR :'||l_invalid_size||'(30)') DEPARTMENT_INDICATOR,
8693 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION:'||l_invalid_size||'(2000)') DESCRIPTION,
8694 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DISADVANTAGED_INDICATOR)),'x')),30) - 30,0,' ','DISADVANTAGED_INDICATOR :'||l_invalid_size||'(30)') DISADVANTAGED_INDICATOR,
8695 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ENQUIRY_DUNS)),'x')),15) - 15,0,' ','ENQUIRY_DUNS :'||l_invalid_size||'(15)') ENQUIRY_DUNS,
8696 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EXPORT_INDICATOR)),'x')),30) - 30,0,' ','EXPORT_INDICATOR :'||l_invalid_size||'(30)') EXPORT_INDICATOR,
8697 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE)),'x')),30) - 30,0,' ','FAILURE_SCORE :'||l_invalid_size||'(30)') FAILURE_SCORE,
8698 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_COMMENTARY)),'x')),30) - 30,0,' ','FAILURE_SCORE_COMMENTARY :'||l_invalid_size||'(30)') FAILURE_SCORE_COMMENTARY,
8699 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_OVERRIDE_CODE)),'x')),30) - 30,0,' ','FAILURE_SCORE_OVERRIDE_CODE :'||l_invalid_size||'(30)') FAILURE_SCORE_OVERRIDE_CODE,
8700 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GLOBAL_FAILURE_SCORE)),'x')),5) - 5,0,' ','GLOBAL_FAILURE_SCORE :'||l_invalid_size||'(5)') GLOBAL_FAILURE_SCORE,
8701 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEADQUARTER_BRANCH_INDICATOR)),'x')),30) - 30,0,' ','HEADQUARTER_BRANCH_INDICATOR :'||l_invalid_size||'(30)') HEADQUARTER_BRANCH_INDICATOR,
8702 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEAD_OF_HOUSEHOLD_FLAG)),'x')),1) - 1,0,' ','HEAD_OF_HOUSEHOLD_FLAG :'||l_invalid_size||'(1)') HEAD_OF_HOUSEHOLD_FLAG,
8703 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(IMPORT_INDICATOR)),'x')),30) - 30,0,' ','IMPORT_INDICATOR :'||l_invalid_size||'(30)') IMPORT_INDICATOR,
8704 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS,
8705 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS2)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS2 :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS2,
8706 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS3)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS3 :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS3,
8707 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS4)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS4 :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS4,
8708 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS5)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS5:'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS5,
8709 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS :'||l_invalid_size||'(240)') PERSON_KNOWN_AS,
8710 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS2 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS2,
8711 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS3 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS3,
8712 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS4 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS4,
8713 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS5 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS5,
8714 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LABOR_SURPLUS_INDICATOR)),'x')),30) - 30,0,' ','LABOR_SURPLUS_INDICATOR :'||l_invalid_size||'(30)') LABOR_SURPLUS_INDICATOR,
8715 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE)),'x')),30) - 30,0,' ','LOCAL_ACTIVITY_CODE :'||l_invalid_size||'(30)') LOCAL_ACTIVITY_CODE,
8716 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE_TYPE)),'x')),30) - 30,0,' ','LOCAL_ACTIVITY_CODE_TYPE :'||l_invalid_size||'(30)') LOCAL_ACTIVITY_CODE_TYPE,
8717 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,' ','LOCATION_DIRECTIONS :'||l_invalid_size||'(640)') LOCATION_DIRECTIONS,
8718 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,' ','MARITAL_STATUS :'||l_invalid_size||'(30)') MARITAL_STATUS,
8719 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_INDICATOR)),'x')),30) - 30,0,' ','MINORITY_OWNED_INDICATOR :'||l_invalid_size||'(30)') MINORITY_OWNED_INDICATOR,
8720 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_TYPE)),'x')),30) - 30,0,' ','MINORITY_OWNED_TYPE :'||l_invalid_size||'(30)') MINORITY_OWNED_TYPE,
8721 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_TYPE)),'x')),30) - 30,0,' ','ORGANIZATION_TYPE :'||l_invalid_size||'(30)') ORGANIZATION_TYPE,
8722 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OUT_OF_BUSINESS_INDICATOR)),'x')),30) - 30,0,' ','OUT_OF_BUSINESS_INDICATOR :'||l_invalid_size||'(30)') OUT_OF_BUSINESS_INDICATOR,
8723 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,' ','PERSON_ACADEMIC_TITLE :'||l_invalid_size||'(30)') PERSON_ACADEMIC_TITLE,
8724 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_FIRST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_FIRST_NAME_PHONETIC,
8725 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_LAST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_LAST_NAME_PHONETIC,
8726 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,' ','MIDDLE_NAME_PHONETIC :'||l_invalid_size||'(60)') MIDDLE_NAME_PHONETIC,
8727 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),320) - 320,0,' ','PERSON_NAME_PHONETIC :'||l_invalid_size||'(320)') PERSON_NAME_PHONETIC,
8728 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,' ','PERSON_PREVIOUS_TITLE_NAME :'||l_invalid_size||'(150)') PERSON_PREVIOUS_TITLE_NAME,
8729 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PLACE_OF_BIRTH)),'x')),60) - 60,0,' ','PLACE_OF_BIRTH :'||l_invalid_size||'(60)') PLACE_OF_BIRTH,
8730 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_NAME)),'x')),240) - 240,0,' ','PRINCIPAL_NAME :'||l_invalid_size||'(240)') PRINCIPAL_NAME,
8731 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_TITLE)),'x')),240) - 240,0,' ','PRINCIPAL_TITLE :'||l_invalid_size||'(240)') PRINCIPAL_TITLE,
8732 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PUBLIC_PRIVATE_OWNERSHIP_FLAG)),'x')),1) - 1,0,' ','PUBLIC_PRIVATE_OWNERSHIP_FLAG :'||l_invalid_size||'(1)') PUBLIC_PRIVATE_OWNERSHIP_FLAG,
8733 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,' ','RENT_OWNED_INDICATOR :'||l_invalid_size||'(30)') RENT_OWNED_INDICATOR,
8734 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECOND_TITLE)),'x')),30) - 30,0,' ','SECOND_TITLE :'||l_invalid_size||'(30)') SECOND_TITLE,
8735 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,
8736 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SMALL_BUSINESS_INDICATOR)),'x')),30) - 30,0,' ','SMALL_BUSINESS_INDICATOR :'||l_invalid_size||'(30)') SMALL_BUSINESS_INDICATOR,
8737 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_ID)),'x')),60) - 60,0,' ','TAX_ID :'||l_invalid_size||'(60)') TAX_ID,
8738 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(WOMAN_OWNED_INDICATOR)),'x')),30) - 30,0,' ',' WOMAN_OWNED_INDICATOR :'||l_invalid_size||'(30)') WOMAN_OWNED_INDICATOR,
8739 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE1,
8740 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE2,
8741 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE3,
8742 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE4,
8743 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE5,
8744 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE6,
8745 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE7,
8746 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE8,
8747 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE9,
8748 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE10,
8749 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE11)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE11 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE11,
8750 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE12,
8751 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE13,
8752 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE14,
8753 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE15,
8754 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE1)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE1 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE1,
8755 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE2)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE2 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE2,
8756 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE3)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE3 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE3,
8757 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE4)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE4 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE4,
8758 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE5)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE5 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE5,
8759 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE6)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE6 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE6,
8760 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE7)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE7 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE7,
8761 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE8)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE8 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE8,
8762 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE9)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE9 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE9,
8763 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE10)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE10 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE10,
8764 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE11)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE11 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE11,
8765 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE12)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE12 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE12,
8766 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE13)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE13 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE13,
8767 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE14)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE14 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE14,
8768 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE15)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE15 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE15,
8769 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE1,
8770 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE2,
8771 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE3,
8772 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE4,
8773 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE5,
8774 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE6,
8775 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE7,
8776 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE8,
8777 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE9,
8778 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE10,
8779 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE11,
8780 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE13,
8781 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE14,
8782 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE15,
8783 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE12,
8784 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE1 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE1,
8785 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE2 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE2,
8786 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE3 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE3,
8787 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE4 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE4,
8788 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE5 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE5,
8789 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE6 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE6,
8790 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE7 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE7,
8791 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE8 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE8,
8792 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE9 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE9,
8793 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE10 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE10,
8794 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE11 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE11,
8795 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE12 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE12,
8796 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE13 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE13,
8797 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE14 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE14,
8798 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE15 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE15,
8799 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,' ','FAX_COUNTRY_CODE :'||l_invalid_size||'(10)') FAX_COUNTRY_CODE,
8800 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,' ','FAX_AREA_CODE :'||l_invalid_size||'(10)') FAX_AREA_CODE,
8801 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,' ','FAX_NUMBER :'||l_invalid_size||'(40)') FAX_NUMBER,
8802 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_ATTRIBUTE_CATEGORY,
8803 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','PERSON_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') PERSON_ATTRIBUTE_CATEGORY,
8804 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_CONTACT_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_CONTACT_ATTRIBUTE_CATEGORY,
8805 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ADDRESS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ADDRESS_ATTRIBUTE_CATEGORY,
8806 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CONTROL_YEAR,' ','x'))),'0123456789.',' x'))),0),0,' ','CONTROL_YEAR :'||l_invalid_number) CONTROL_YEAR,
8807 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DEBARMENTS_COUNT,' ','x'))),'0123456789.',' x'))),0),0,' ','DEBARMENTS_COUNT :'||l_invalid_number) DEBARMENTS_COUNT,
8808 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,' ','HOUSEHOLD_SIZE :'||l_invalid_number) HOUSEHOLD_SIZE,
8809 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','PERSONAL_INCOME :'||l_invalid_number) PERSONAL_INCOME,
8810 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,' ','NOTES :'||l_invalid_size||'(2000)') NOTES,
8811 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,' ','VEHICLE_RESPONSE_CODE :'||l_invalid_size||'(30)') VEHICLE_RESPONSE_CODE,
8812 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,' ','SALES_AGENT_EMAIL_ADDRESS:'||l_invalid_size||'(2000)') SALES_AGENT_EMAIL_ADDRESS,
8813 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,' ','ORIG_SYSTEM_REFERENCE:'||l_invalid_size||'(240)') ORIG_SYSTEM_REFERENCE,
8814 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_EMAIL_ADDRESS)),'x')),240) - 240,0,' ','ORG_EMAIL_ADDRESS :'||l_invalid_size||'(240)') ORG_EMAIL_ADDRESS,
8815 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PHONE_TYPE)),'x')),30) - 30,0,' ','ORG_PHONE_TYPE :'||l_invalid_size||'(30)') ORG_PHONE_TYPE,
8816 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_TYPE)),'x')),30) - 30,0,' ','PHONE_TYPE :'||l_invalid_size||'(30)') PHONE_TYPE,
8817 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_COUNTRY_CODE)),'x')),30) - 30,0,' ','ORG_PH_COUNTRY_CODE :'||l_invalid_size||'(30)') ORG_PH_COUNTRY_CODE,
8818 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_AREA_CODE)),'x')),10) - 10,0,' ','ORG_PH_AREA_CODE :'||l_invalid_size||'(10)') ORG_PH_AREA_CODE,
8819 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_NUMBER)),'x')),25) - 25,0,' ','ORG_PH_NUMBER :'||l_invalid_size||'(25)') ORG_PH_NUMBER,
8820 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_EXTENSION)),'x')),20) - 20,0,' ','ORG_PH_EXTENSION :'||l_invalid_size||'(20)') ORG_PH_EXTENSION,
8821 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS1)),'x')),240) - 240,0,' ','ORG_ADDRESS1 :'||l_invalid_size||'(240)') ORG_ADDRESS1,
8822 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS2)),'x')),240) - 240,0,' ','ORG_ADDRESS2 :'||l_invalid_size||'(240)') ORG_ADDRESS2,
8823 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS3)),'x')),240) - 240,0,' ','ORG_ADDRESS3 :'||l_invalid_size||'(240)') ORG_ADDRESS3,
8824 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS4)),'x')),240) - 240,0,' ','ORG_ADDRESS4 :'||l_invalid_size||'(240)') ORG_ADDRESS4,
8825 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CITY)),'x')),60) - 60,0,' ','ORG_CITY :'||l_invalid_size||'(60)') ORG_CITY ,
8826 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_POSTAL_CODE)),'x')),60) - 60,0,' ','ORG_POSTAL_CODE :'||l_invalid_size||'(60)') ORG_POSTAL_CODE,
8827 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_STATE)),'x')),60) - 60,0,' ','ORG_STATE :'||l_invalid_size||'(60)') ORG_STATE,
8828 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PROVINCE)),'x')),60) - 60,0,' ','ORG_PROVINCE :'||l_invalid_size||'(60)') ORG_PROVINCE,
8829 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_COUNTY)),'x')),60) - 60,0,' ','ORG_COUNTY :'||l_invalid_size||'(60)') ORG_COUNTY,
8830 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_COUNTRY)),'x')),60) - 60,0,' ','ORG_COUNTRY :'||l_invalid_size||'(60)') ORG_COUNTRY,
8831 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_ADDR_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_ADDR_ATTRIBUTE_CATEGORY,
8832 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE1,
8833 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE2,
8834 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE3,
8835 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE4,
8836 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE5,
8837 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE6,
8838 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE7,
8839 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE8,
8840 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE9,
8841 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE10,
8842 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE11)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE11 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE11,
8843 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE12,
8844 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE13,
8845 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE14,
8846 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE15,
8847 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE16)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE16 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE16,
8848 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE17)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE17 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE17,
8849 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE18)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE18 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE18,
8850 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE19)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE19 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE19,
8851 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE20)),'x')),150) - 150,0,' ','ORG_ADDR_ATTRIBUTE20 :'||l_invalid_size||'(150)') ORG_ADDR_ATTRIBUTE20,
8852 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_CPS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_CPS_ATTRIBUTE_CATEGORY,
8853 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE1,
8854 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE2,
8855 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE3,
8856 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE4,
8857 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE5,
8858 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE6,
8859 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE7,
8860 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE8,
8861 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE9,
8862 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE10,
8863 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE11)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE11 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE11,
8864 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE12,
8865 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE13,
8866 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE14,
8867 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE15,
8868 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE16)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE16 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE16,
8869 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE17)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE17 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE17,
8870 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE18)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE18 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE18,
8871 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE19)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE19 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE19,
8872 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE20)),'x')),150) - 150,0,' ','ORG_CPS_ATTRIBUTE20 :'||l_invalid_size||'(150)') ORG_CPS_ATTRIBUTE20,
8873 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_PS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_PS_ATTRIBUTE_CATEGORY,
8874 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE1,
8875 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE2,
8876 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE3,
8877 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE4,
8878 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE5,
8879 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE6,
8880 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE7,
8881 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE8,
8882 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE9,
8883 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE10,
8884 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE11)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE11 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE11,
8885 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE12,
8886 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE13,
8887 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE14,
8888 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE15,
8889 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE16)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE16 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE16,
8890 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE17)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE17 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE17,
8891 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE18)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE18 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE18,
8892 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE19)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE19 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE19,
8893 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE20)),'x')),150) - 150,0,' ','ORG_PS_ATTRIBUTE20 :'||l_invalid_size||'(150)') ORG_PS_ATTRIBUTE20,
8894 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NATIVE_LANGUAGE)),'x')),4) - 4,0,' ','LANGUAGE :'||l_invalid_size||'(4)') NATIVE_LANGUAGE
8895 FROM AMS_HZ_B2B_MAPPING_V
8896 WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
8897 and load_status in ('ACTIVE','RELOAD')
8898 AND
8899 (
8900 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PARTY_NAME))),255) - 255,0,'OK','NO') = 'NO'
8901 or
8902 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FISCAL_YEAREND_MONTH)),'x')),30) - 30,0,'OK','NO') = 'NO'
8903 /* or
8904 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DUNS_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8905 */
8906 or
8907 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(EMPLOYEES_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8908 or
8909 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(YEAR_ESTABLISHED,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8910 or
8911 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_ORDERED_AMOUNT,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8912 or
8913 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(TOTAL_NUM_OF_ORDERS,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8914 or
8915 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CURR_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8916 or
8917 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(NEXT_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8918 or
8919 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
8920 or
8921 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LINE_OF_BUSINESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
8922 or
8923 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
8924 or
8925 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
8926 or
8927 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
8928 or
8929 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
8930 or
8931 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),50) - 50,0,'OK','NO') = 'NO'
8932 or
8933 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CEO_NAME)),'x')),240) - 240,0,'OK','NO') = 'NO'
8934 or
8935 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME)),'x')),50) - 50,0,'OK','NO') = 'NO'
8936 or
8937 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME)),'x')),40) - 40,0,'OK','NO') = 'NO'
8938 or
8939 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
8940 or
8941 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE)),'x')),100) - 100,0,'OK','NO') = 'NO'
8942 or
8943 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
8944 or
8945 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
8946 or
8947 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
8948 or
8949 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
8950 or
8951 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
8952 or
8953 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
8954 or
8955 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
8956 or
8957 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DUNS_NUMBER)),'x')),30) - 30,0,'OK','NO') = 'NO'
8958 or
8959 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
8960 or
8961 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,'OK','NO') = 'NO'
8962 or
8963 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
8964 or
8965 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
8966 or
8967 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
8968 or
8969 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
8970 or
8971 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,'OK','NO') = 'NO'
8972 or
8973 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT)),'x')),60) - 60,0,'OK','NO') = 'NO'
8974 or
8975 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
8976 or
8977 DECODE(GREATEST(lengthb(nvl(SIC_CODE,'x')),30) - 30,0,'OK','NO') = 'NO'
8978 or
8979 DECODE(GREATEST(lengthb(nvl(SIC_CODE_TYPE,'x')),30) - 30,0,'OK','NO') = 'NO'
8980 or
8981 DECODE(GREATEST(lengthb(nvl(ANALYSIS_FY,'x')),5) - 5,0,'OK','NO') = 'NO'
8982 or
8983 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,'OK','NO') = 'NO'
8984 or
8985 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GSA_INDICATOR_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
8986 or
8987 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OVERSEAS_ADDRESS_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
8988 or
8989 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(APARTMENT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
8990 or
8991 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MISSION_STATEMENT)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
8992 or
8993 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_NAME_PHONETIC)),'x')),320) - 320,0,'OK','NO') = 'NO'
8994 or
8995 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CATEGORY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
8996 or
8997 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JGZZ_FISCAL_CODE)),'x')),20) - 20,0,'OK','NO') = 'NO'
8998 or
8999 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
9000 or
9001 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,'OK','NO') = 'NO'
9002 or
9003 /*
9004 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9005 or
9006 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,'OK','NO') = 'NO'
9007 or
9008 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9009 or
9010 */
9011 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),50) - 50,0,'OK','NO') = 'NO'
9012 or
9013 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,'OK','NO') = 'NO'
9014 --or
9015 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECONDARY_SUFFIX_ELENENT)),'x')),240) - 240,0,'OK','NO') = 'NO'
9016 or
9017 /*
9018 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,'OK','NO') = 'NO'
9019 or
9020 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9021 or
9022 */
9023 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_TYPE)),'x')),50) - 50,0,'OK','NO') = 'NO'
9024 or
9025 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9026 or
9027 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9028 or
9029 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BRANCH_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
9030 or
9031 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEAD_OF_HOUSEHOLD_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
9032 or
9033 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PUBLIC_PRIVATE_OWNERSHIP_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
9034 or
9035 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_LINE)),'x')),240) - 240,0,'OK','NO') = 'NO'
9036 or
9037 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_SCOPE)),'x')),20) - 20,0,'OK','NO') = 'NO'
9038 or
9039 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CHIEF_EXECUTIVE_TITLE)),'x')),240) - 240,0,'OK','NO') = 'NO'
9040 or
9041 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
9042 or
9043 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
9044 or
9045 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
9046 or
9047 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
9048 or
9049 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
9050 or
9051 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
9052 or
9053 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
9054 or
9055 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
9056 or
9057 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
9058 or
9059 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
9060 or
9061 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_NAME)),'x')),240) - 240,0,'OK','NO') = 'NO'
9062 or
9063 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_TITLE)),'x')),240) - 240,0,'OK','NO') = 'NO'
9064 or
9065 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,'OK','NO') = 'NO'
9066 or
9067 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),360) - 360,0,'OK','NO') = 'NO'
9068 or
9069 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,'OK','NO') = 'NO'
9070 or
9071 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONGRESSIONAL_DISTRICT_CODE)),'x')),2) - 2,0,'OK','NO') = 'NO'
9072 or
9073 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CORPORATION_CLASS)),'x')),60) - 60,0,'OK','NO') = 'NO'
9074 or
9075 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
9076 or
9077 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
9078 or
9079 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
9080 or
9081 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PLACE_OF_BIRTH)),'x')),60) - 60,0,'OK','NO') = 'NO'
9082 or
9083 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_ID)),'x')),60) - 60,0,'OK','NO') = 'NO'
9084 or
9085 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9086 or
9087 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(WOMAN_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9088 or
9089 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9090 or
9091 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,'OK','NO') = 'NO'
9092 or
9093 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,'OK','NO') = 'NO'
9094 or
9095 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECOND_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9096 or
9097 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SMALL_BUSINESS_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9098 or
9099 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9100 or
9101 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9102 or
9103 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9104 or
9105 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OUT_OF_BUSINESS_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9106 or
9107 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9108 or
9109 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LABOR_SURPLUS_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9110 or
9111 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9112 or
9113 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9114 or
9115 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(IMPORT_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9116 or
9117 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DISADVANTAGED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9118 or
9119 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9120 or
9121 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE_COMMENTARY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9122 or
9123 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EXPORT_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9124 or
9125 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9126 or
9127 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_COMMENTARY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9128 or
9129 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_OVERRIDE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9130 or
9131 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DB_RATING)),'x')),5) - 5,0,'OK','NO') = 'NO'
9132 or
9133 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GLOBAL_FAILURE_SCORE)),'x')),5) - 5,0,'OK','NO') = 'NO'
9134 or
9135 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ENQUIRY_DUNS)),'x')),15) - 15,0,'OK','NO') = 'NO'
9136 or
9137 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9138 or
9139 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9140 or
9141 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9142 or
9143 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9144 or
9145 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9146 or
9147 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9148 or
9149 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9150 or
9151 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9152 or
9153 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9154 or
9155 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9156 or
9157 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9158 or
9159 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9160 or
9161 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9162 or
9163 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9164 or
9165 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9166 or
9167 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9168 or
9169 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9170 or
9171 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9172 or
9173 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9174 or
9175 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9176 or
9177 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9178 or
9179 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9180 or
9181 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9182 or
9183 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9184 or
9185 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9186 or
9187 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9188 or
9189 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9190 or
9191 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9192 or
9193 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9194 or
9195 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9196 or
9197 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9198 or
9199 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9200 or
9201 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9202 or
9203 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9204 or
9205 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9206 or
9207 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9208 or
9209 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9210 or
9211 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9212 or
9213 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9214 or
9215 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9216 or
9217 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9218 or
9219 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9220 or
9221 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9222 or
9223 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9224 or
9225 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9226 or
9227 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9228 or
9229 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9230 or
9231 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9232 or
9233 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9234 or
9235 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9236 or
9237 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9238 or
9239 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9240 or
9241 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9242 or
9243 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9244 or
9245 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9246 or
9247 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9248 or
9249 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9250 or
9251 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9252 or
9253 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9254 or
9255 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9256 or
9257 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9258 or
9259 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9260 or
9261 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9262 or
9263 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9264 or
9265 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9266 or
9267 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9268 or
9269 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
9270 or
9271 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
9272 or
9273 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,'OK','NO') = 'NO'
9274 or
9275 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CONTROL_YEAR,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9276 or
9277 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DEBARMENTS_COUNT,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9278 or
9279 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9280 or
9281 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9282 or
9283 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9284 or
9285 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9286 or
9287 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9288 or
9289 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,'OK','NO') = 'NO'
9290 or
9291 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
9292 or
9293 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PHONE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9294 or
9295 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9296 or
9297 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
9298 or
9299 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
9300 or
9301 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PH_EXTENSION)),'x')),20) - 20,0,'OK','NO') = 'NO'
9302 or
9303 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
9304 or
9305 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
9306 or
9307 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
9308 or
9309 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
9310 or
9311 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9312 or
9313 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9314 or
9315 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9316 or
9317 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9318 or
9319 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9320 or
9321 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9322 or
9323 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9324 or
9325 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9326 or
9327 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9328 or
9329 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9330 or
9331 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9332 or
9333 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9334 or
9335 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9336 or
9337 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9338 or
9339 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9340 or
9341 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9342 or
9343 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9344 or
9345 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9346 or
9347 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9348 or
9349 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9350 or
9351 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9352 or
9353 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9354 or
9355 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE16)),'x')),150) - 150,0,'OK','NO') = 'NO'
9356 or
9357 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE17)),'x')),150) - 150,0,'OK','NO') = 'NO'
9358 or
9359 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE18)),'x')),150) - 150,0,'OK','NO') = 'NO'
9360 or
9361 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE19)),'x')),150) - 150,0,'OK','NO') = 'NO'
9362 or
9363 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ADDR_ATTRIBUTE20)),'x')),150) - 150,0,'OK','NO') = 'NO'
9364 or
9365 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9366 or
9367 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9368 or
9369 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9370 or
9371 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9372 or
9373 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9374 or
9375 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9376 or
9377 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9378 or
9379 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9380 or
9381 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9382 or
9383 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9384 or
9385 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9386 or
9387 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9388 or
9389 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9390 or
9391 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9392 or
9393 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9394 or
9395 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9396 or
9397 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE16)),'x')),150) - 150,0,'OK','NO') = 'NO'
9398 or
9399 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE17)),'x')),150) - 150,0,'OK','NO') = 'NO'
9400 or
9401 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE18)),'x')),150) - 150,0,'OK','NO') = 'NO'
9402 or
9403 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE19)),'x')),150) - 150,0,'OK','NO') = 'NO'
9404 or
9405 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CPS_ATTRIBUTE20)),'x')),150) - 150,0,'OK','NO') = 'NO'
9406 or
9407 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9408 or
9409 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9410 or
9411 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9412 or
9413 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9414 or
9415 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9416 or
9417 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9418 or
9419 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9420 or
9421 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9422 or
9423 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9424 or
9425 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9426 or
9427 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9428 or
9429 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9430 or
9431 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9432 or
9433 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9434 or
9435 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9436 or
9437 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9438 or
9439 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE16)),'x')),150) - 150,0,'OK','NO') = 'NO'
9440 or
9441 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE17)),'x')),150) - 150,0,'OK','NO') = 'NO'
9442 or
9443 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE18)),'x')),150) - 150,0,'OK','NO') = 'NO'
9444 or
9445 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE19)),'x')),150) - 150,0,'OK','NO') = 'NO'
9446 or
9447 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_PS_ATTRIBUTE20)),'x')),150) - 150,0,'OK','NO') = 'NO'
9448 or
9449 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9450 or
9451 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NATIVE_LANGUAGE)),'x')),4) - 4,0,'OK','NO') = 'NO'
9452
9453 );
9454
9455
9456
9457
9458 -- Cursor for B2C party type
9459
9460 cursor b2c is
9461 SELECT
9462 IMPORT_SOURCE_LINE_ID,
9463 import_list_header_id,
9464 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,' ','ADDRESS1 :'||l_invalid_size||'(240)') ADDRESS1,
9465 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,' ','ADDRESS2 :'||l_invalid_size||'(240)') ADDRESS2,
9466 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,' ','ADDRESS3 :'||l_invalid_size||'(240)') ADDRESS3,
9467 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,' ','ADDRESS4 :'||l_invalid_size||'(240)') ADDRESS4,
9468 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PERSON_LAST_NAME))),50) - 50,0,' ','PERSON_LAST_NAME :'||decode(nvl(PERSON_LAST_NAME,'x'),'x',l_null_value,l_invalid_size)||'(50)') PERSON_LAST_NAME,
9469 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PERSON_FIRST_NAME))),40) - 40,0,' ','PERSON_FIRST_NAME :'||decode(nvl(PERSON_FIRST_NAME,'x'),'x',l_null_value,l_invalid_size)||'(40)') PERSON_FIRST_NAME,
9470 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,' ','PERSON_NAME_PREFIX :'||l_invalid_size||'(30)') PERSON_NAME_PREFIX,
9471 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,' ','PERSON_MIDDLE_NAME :'||l_invalid_size||'(60)') PERSON_MIDDLE_NAME,
9472 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,' ','PERSON_NAME_SUFFIX :'||l_invalid_size||'(30)') PERSON_NAME_SUFFIX,
9473 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,' ','CITY :'||l_invalid_size||'(60)') CITY ,
9474 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALUTATION)),'x')),60) - 60,0,' ','SALUTATION :'||l_invalid_size||'(60)') SALUTATION,
9475 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,' ','POSTAL_CODE :'||l_invalid_size||'(60)') POSTAL_CODE,
9476 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,' ','STATE :'||l_invalid_size||'(60)') STATE,
9477 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,' ','PROVINCE :'||l_invalid_size||'(60)') PROVINCE,
9478 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,' ','COUNTY :'||l_invalid_size||'(60)') COUNTY,
9479 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,' ','COUNTRY :'||l_invalid_size||'(60)') COUNTRY,
9480 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,' ','TIME_ZONE :'||l_invalid_size||'(50)') TIME_ZONE,
9481 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,' ','EMAIL_ADDRESS :'||l_invalid_size||'(240)') EMAIL_ADDRESS,
9482 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,' ','PHONE_COUNTRY_CODE :'||l_invalid_size||'(30)') PHONE_COUNTRY_CODE,
9483 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,' ','PHONE_AREA_CODE :'||l_invalid_size||'(10)') PHONE_AREA_CODE,
9484 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,' ','PHONE_NUMBER :'||l_invalid_size||'(25)') PHONE_NUMBER,
9485 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,' ','PHONE_EXTENTION :'||l_invalid_size||'(20)') PHONE_EXTENTION,
9486 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OVERSEAS_ADDRESS_FLAG)),'x')),1) - 1,0,' ','OVERSEAS_ADDRESS_FLAG :'||l_invalid_size||'(1)') OVERSEAS_ADDRESS_FLAG,
9487 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,' ','identifying_address_flag :'||l_invalid_size||'(1)') identifying_address_flag,
9488 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(APARTMENT_FLAG)),'x')),1) - 1,0,' ','APARTMENT_FLAG :'||l_invalid_size||'(1)') APARTMENT_FLAG,
9489 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,' ','ADDRESS_LINES_PHONETIC :'||l_invalid_size||'(560)') ADDRESS_LINES_PHONETIC,
9490 -- bug 4641591: columns obsolete
9491 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,' ','PO_BOX_NUMBER :'||l_invalid_size||'(50)') PO_BOX_NUMBER,
9492 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,' ','FLOOR :'||l_invalid_size||'(50)') FLOOR,
9493 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,' ','HOUSE_NUMBER :'||l_invalid_size||'(50)') HOUSE_NUMBER,
9494 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),10) - 10,0,' ','POSTAL_PLUS4_CODE :'||l_invalid_size||'(10)') POSTAL_PLUS4_CODE,
9495 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,' ','STREET_SUFFIX :'||l_invalid_size||'(50)') STREET_SUFFIX,
9496 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECONDARY_SUFFIX_ELEMENT)),'x')),240) - 240,0,' ','SECONDARY_SUFFIX_ELEMENT :'||l_invalid_size||'(240)') SECONDARY_SUFFIX_ELEMENT,
9497 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,' ','STREET :'||l_invalid_size||'(50)') STREET,
9498 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,' ','STREET_NUMBER :'||l_invalid_size||'(50)') STREET_NUMBER,
9499 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SUITE)),'x')),50) - 50,0,' ','SUITE :'||l_invalid_size||'(50)') SUITE,
9500 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_TYPE)),'x')),50) - 50,0,' ','RURAL_ROUTE_TYPE :'||l_invalid_size||'(50)') RURAL_ROUTE_TYPE,
9501 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_NUMBER)),'x')),50) - 50,0,' ','RURAL_ROUTE_NUMBER :'||l_invalid_size||'(50)') RURAL_ROUTE_NUMBER,
9502 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,' ','PARTY_ID :'||l_invalid_number) party_id,
9503 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URL)),'x')),2000) - 2000,0,' ','URL :'||l_invalid_size||'(2000)') URL,
9504 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,' ','DECLARED_ETHNICITY :'||l_invalid_size||'(60)') DECLARED_ETHNICITY,
9505 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION:'||l_invalid_size||'(2000)') DESCRIPTION,
9506 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEAD_OF_HOUSEHOLD_FLAG)),'x')),1) - 1,0,' ','HEAD_OF_HOUSEHOLD_FLAG :'||l_invalid_size||'(1)') HEAD_OF_HOUSEHOLD_FLAG,
9507 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS :'||l_invalid_size||'(240)') PERSON_KNOWN_AS,
9508 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS2 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS2,
9509 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS3 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS3,
9510 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS4 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS4,
9511 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS5 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS5,
9512 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,' ','LOCATION_DIRECTIONS:'||l_invalid_size||'(640)') LOCATION_DIRECTIONS,
9513 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,' ','MARITAL_STATUS :'||l_invalid_size||'(30)') MARITAL_STATUS,
9514 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,' ','PERSON_ACADEMIC_TITLE :'||l_invalid_size||'(30)') PERSON_ACADEMIC_TITLE,
9515 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_FIRST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_FIRST_NAME_PHONETIC,
9516 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_LAST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_LAST_NAME_PHONETIC,
9517 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,' ','MIDDLE_NAME_PHONETIC :'||l_invalid_size||'(60)') MIDDLE_NAME_PHONETIC,
9518 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),320) - 320,0,' ','PERSON_NAME_PHONETIC :'||l_invalid_size||'(320)') PERSON_NAME_PHONETIC,
9519 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,' ','PERSON_PREVIOUS_TITLE_NAME :'||l_invalid_size||'(150)') PERSON_PREVIOUS_TITLE_NAME,
9520 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECOND_TITLE)),'x')),30) - 30,0,' ','SECOND_TITLE :'||l_invalid_size||'(30)') SECOND_TITLE,
9521 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,
9522 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE1)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE1 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE1,
9523 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE2)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE2 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE2,
9524 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE3)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE3 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE3,
9525 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE4)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE4 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE4,
9526 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE5)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE5 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE5,
9527 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE6)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE6 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE6,
9528 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE7)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE7 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE7,
9529 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE8)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE8 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE8,
9530 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE9)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE9 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE9,
9531 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE10)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE10 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE10,
9532 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE11)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE11 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE11,
9533 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE12)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE12 : '||l_invalid_size||'(150)') PERSON_ATTRIBUTE12,
9534 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE13)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE13 : '||l_invalid_size||'(150)') PERSON_ATTRIBUTE13,
9535 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE14)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE14 : '||l_invalid_size||'(150)') PERSON_ATTRIBUTE14,
9536 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE15)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE15 : '||l_invalid_size||'(150)') PERSON_ATTRIBUTE15,
9537 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE1 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE1,
9538 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE2 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE2,
9539 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE3 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE3,
9540 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE4 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE4,
9541 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE5 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE5,
9542 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE6 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE6,
9543 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE7 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE7,
9544 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE8 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE8,
9545 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE9 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE9,
9546 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE10 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE10,
9547 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE11 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE11,
9548 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE12 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE12,
9549 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE13 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE13,
9550 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE14 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE14,
9551 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE15 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE15,
9552 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,' ','FAX_COUNTRY_CODE :'||l_invalid_size||'(10)') FAX_COUNTRY_CODE,
9553 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,' ','FAX_AREA_CODE :'||l_invalid_size||'(10)') FAX_AREA_CODE,
9554 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,' ','FAX_NUMBER :'||l_invalid_size||'(40)') FAX_NUMBER,
9555 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','PERSON_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') PERSON_ATTRIBUTE_CATEGORY,
9556 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ADDRESS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ADDRESS_ATTRIBUTE_CATEGORY,
9557 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,' ','HOUSEHOLD_SIZE :'||l_invalid_number) HOUSEHOLD_SIZE,
9558 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','HOUSEHOLD_INCOME :'||l_invalid_number) HOUSEHOLD_INCOME,
9559 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','PERSONAL_INCOME :'||l_invalid_number) PERSONAL_INCOME,
9560 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION:'||l_invalid_size||'(2000)') DESCRIPTION,
9561 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,
9562 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,' ','NOTES :'||l_invalid_size||'(2000)') NOTES,
9563 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,' ','VEHICLE_RESPONSE_CODE :'||l_invalid_size||'(30)') VEHICLE_RESPONSE_CODE,
9564 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,' ','SALES_AGENT_EMAIL_ADDRESS:'||l_invalid_size||'(2000)') SALES_AGENT_EMAIL_ADDRESS,
9565 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),60) - 60,0,' ','TAX_REFERENCE :'||l_invalid_size||'(60)') TAX_REFERENCE,
9566 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,' ','RENT_OWNED_INDICATOR :'||l_invalid_size||'(30)') RENT_OWNED_INDICATOR,
9567 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GENDER)),'x')),30) - 30,0,' ','GENDER :'||l_invalid_size||'(30)') GENDER,
9568 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,' ','ORIG_SYSTEM_REFERENCE:'||l_invalid_size||'(240)') ORIG_SYSTEM_REFERENCE,
9569 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_TYPE)),'x')),30) - 30,0,' ','PHONE_TYPE :'||l_invalid_size||'(30)') PHONE_TYPE,
9570 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','PS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') PS_ATTRIBUTE_CATEGORY,
9571 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE1)),'x')),150) - 150,0,' ','PS_ATTRIBUTE1 :'||l_invalid_size||'(150)') PS_ATTRIBUTE1,
9572 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE2)),'x')),150) - 150,0,' ','PS_ATTRIBUTE2 :'||l_invalid_size||'(150)') PS_ATTRIBUTE2,
9573 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE3)),'x')),150) - 150,0,' ','PS_ATTRIBUTE3 :'||l_invalid_size||'(150)') PS_ATTRIBUTE3,
9574 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE4)),'x')),150) - 150,0,' ','PS_ATTRIBUTE4 :'||l_invalid_size||'(150)') PS_ATTRIBUTE4,
9575 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE5)),'x')),150) - 150,0,' ','PS_ATTRIBUTE5 :'||l_invalid_size||'(150)') PS_ATTRIBUTE5,
9576 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE6)),'x')),150) - 150,0,' ','PS_ATTRIBUTE6 :'||l_invalid_size||'(150)') PS_ATTRIBUTE6,
9577 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE7)),'x')),150) - 150,0,' ','PS_ATTRIBUTE7 :'||l_invalid_size||'(150)') PS_ATTRIBUTE7,
9578 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE8)),'x')),150) - 150,0,' ','PS_ATTRIBUTE8 :'||l_invalid_size||'(150)') PS_ATTRIBUTE8,
9579 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE9)),'x')),150) - 150,0,' ','PS_ATTRIBUTE9 :'||l_invalid_size||'(150)') PS_ATTRIBUTE9,
9580 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE10)),'x')),150) - 150,0,' ','PS_ATTRIBUTE10 :'||l_invalid_size||'(150)') PS_ATTRIBUTE10,
9581 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE11)),'x')),150) - 150,0,' ','PS_ATTRIBUTE11 :'||l_invalid_size||'(150)') PS_ATTRIBUTE11,
9582 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE12)),'x')),150) - 150,0,' ','PS_ATTRIBUTE12 :'||l_invalid_size||'(150)') PS_ATTRIBUTE12,
9583 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE13)),'x')),150) - 150,0,' ','PS_ATTRIBUTE13 :'||l_invalid_size||'(150)') PS_ATTRIBUTE13,
9584 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE14)),'x')),150) - 150,0,' ','PS_ATTRIBUTE14 :'||l_invalid_size||'(150)') PS_ATTRIBUTE14,
9585 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE15)),'x')),150) - 150,0,' ','PS_ATTRIBUTE15 :'||l_invalid_size||'(150)') PS_ATTRIBUTE15,
9586 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE16)),'x')),150) - 150,0,' ','PS_ATTRIBUTE16 :'||l_invalid_size||'(150)') PS_ATTRIBUTE16,
9587 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE17)),'x')),150) - 150,0,' ','PS_ATTRIBUTE17 :'||l_invalid_size||'(150)') PS_ATTRIBUTE17,
9588 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE18)),'x')),150) - 150,0,' ','PS_ATTRIBUTE18 :'||l_invalid_size||'(150)') PS_ATTRIBUTE18,
9589 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE19)),'x')),150) - 150,0,' ','PS_ATTRIBUTE19 :'||l_invalid_size||'(150)') PS_ATTRIBUTE19,
9590 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE20)),'x')),150) - 150,0,' ','PS_ATTRIBUTE20 :'||l_invalid_size||'(150)') PS_ATTRIBUTE20,
9591 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NATIVE_LANGUAGE)),'x')),4) - 4,0,' ','LANGUAGE :'||l_invalid_size||'(4)') NATIVE_LANGUAGE,
9592 Null col1,
9593 Null col2,
9594 Null col3,
9595 Null col4,
9596 Null col5,
9597 Null col6,
9598 Null col7,
9599 Null col8,
9600 Null col9,
9601 Null col10,
9602 Null col11,
9603 Null col12,
9604 Null col13,
9605 Null col14,
9606 Null col15,
9607 Null col16,
9608 Null col17,
9609 Null col18,
9610 Null col19,
9611 Null col20,
9612 Null col21,
9613 Null col22,
9614 Null col23,
9615 Null col24,
9616 Null col25,
9617 Null col26,
9618 Null col27,
9619 Null col28,
9620 Null col29,
9621 Null col30,
9622 Null col31,
9623 Null col32,
9624 Null col33,
9625 Null col34,
9626 Null col35,
9627 Null col36,
9628 Null col37,
9629 Null col38,
9630 Null col39,
9631 Null col40,
9632 Null col41,
9633 Null col42,
9634 Null col43,
9635 Null col44,
9636 Null col45,
9637 Null col46,
9638 Null col47,
9639 Null col48,
9640 Null col49,
9641 Null col50,
9642 Null col51,
9643 Null col52,
9644 Null col53,
9645 Null col54,
9646 Null col55,
9647 Null col56,
9648 Null col57,
9649 Null col58,
9650 Null col59,
9651 Null col60,
9652 Null col61,
9653 Null col62,
9654 Null col63,
9655 Null col64,
9656 Null col65,
9657 Null col66,
9658 Null col67,
9659 Null col68,
9660 Null col69,
9661 Null col70,
9662 Null col71,
9663 Null col72,
9664 Null col73,
9665 Null col74,
9666 Null col75,
9667 Null col76,
9668 Null col77,
9669 Null col78,
9670 Null col79,
9671 Null col80,
9672 Null col81,
9673 Null col82,
9674 Null col83,
9675 Null col84,
9676 Null col85,
9677 Null col86,
9678 Null col87,
9679 Null col88,
9680 Null col89,
9681 Null col90,
9682 Null col91,
9683 Null col92,
9684 Null col93,
9685 Null col94,
9686 Null col95,
9687 Null col96,
9688 Null col97,
9689 Null col98,
9690 Null col99,
9691 Null col100,
9692 Null col101,
9693 Null col102,
9694 Null col103,
9695 Null col104,
9696 Null col105,
9697 Null col106,
9698 Null col107,
9699 Null col108,
9700 Null col109,
9701 Null col110,
9702 Null col111,
9703 Null col112,
9704 Null col113,
9705 Null col114,
9706 Null col115,
9707 Null col116,
9708 Null col117,
9709 Null col118,
9710 Null col119,
9711 Null col120,
9712 Null col121,
9713 Null col122,
9714 Null col123,
9715 Null col124,
9716 Null col125,
9717 Null col126,
9718 Null col127,
9719 Null col128,
9720 Null col129,
9721 Null col130,
9722 Null col131,
9723 Null col132,
9724 Null col133,
9725 Null col134,
9726 Null col135,
9727 Null col136,
9728 Null col137,
9729 Null col138,
9730 Null col139,
9731 Null col140,
9732 Null col141,
9733 Null col142,
9734 Null col143,
9735 Null col144,
9736 Null col145,
9737 Null col146,
9738 Null col147,
9739 Null col148
9740 FROM AMS_HZ_B2C_MAPPING_V
9741 WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
9742 and load_status in ('ACTIVE','RELOAD')
9743 AND
9744 (
9745 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9746 or
9747 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
9748 or
9749 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
9750 or
9751 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
9752 or
9753 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
9754 or
9755 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME)),'x')),50) - 50,0,'OK','NO') = 'NO'
9756 or
9757 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME)),'x')),40) - 40,0,'OK','NO') = 'NO'
9758 or
9759 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
9760 or
9761 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
9762 or
9763 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
9764 or
9765 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9766 or
9767 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9768 or
9769 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9770 or
9771 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALUTATION)),'x')),60) - 60,0,'OK','NO') = 'NO'
9772 or
9773 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9774 or
9775 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9776 or
9777 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9778 or
9779 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,'OK','NO') = 'NO'
9780 or
9781 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
9782 or
9783 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9784 or
9785 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
9786 or
9787 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
9788 or
9789 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,'OK','NO') = 'NO'
9790 or
9791 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,'OK','NO') = 'NO'
9792 or
9793 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OVERSEAS_ADDRESS_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
9794 or
9795 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(APARTMENT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
9796 or
9797 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,'OK','NO') = 'NO'
9798 or
9799 /*
9800 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9801 or
9802 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,'OK','NO') = 'NO'
9803 or
9804 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9805 or
9806 */
9807 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),50) - 50,0,'OK','NO') = 'NO'
9808 or
9809 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,'OK','NO') = 'NO'
9810 --or
9811 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECONDARY_SUFFIX_ELEMENT)),'x')),240) - 240,0,'OK','NO') = 'NO'
9812 or
9813 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,'OK','NO') = 'NO'
9814 or
9815 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9816 or
9817 /*
9818 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,'OK','NO') = 'NO'
9819 or
9820 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9821 or
9822 */
9823 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_TYPE)),'x')),50) - 50,0,'OK','NO') = 'NO'
9824 or
9825 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
9826 or
9827 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9828 or
9829 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
9830 or
9831 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
9832 or
9833 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
9834 or
9835 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
9836 or
9837 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
9838 or
9839 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,'OK','NO') = 'NO'
9840 or
9841 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),360) - 360,0,'OK','NO') = 'NO'
9842 or
9843 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,'OK','NO') = 'NO'
9844 or
9845 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
9846 or
9847 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
9848 or
9849 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
9850 or
9851 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PLACE_OF_BIRTH)),'x')),60) - 60,0,'OK','NO') = 'NO'
9852 or
9853 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,'OK','NO') = 'NO'
9854 or
9855 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,'OK','NO') = 'NO'
9856 or
9857 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SECOND_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9858 or
9859 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9860 or
9861 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
9862 or
9863 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9864 or
9865 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9866 or
9867 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9868 or
9869 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9870 or
9871 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9872 or
9873 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9874 or
9875 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9876 or
9877 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9878 or
9879 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9880 or
9881 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9882 or
9883 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9884 or
9885 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9886 or
9887 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9888 or
9889 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9890 or
9891 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9892 or
9893 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9894 or
9895 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9896 or
9897 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9898 or
9899 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9900 or
9901 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9902 or
9903 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9904 or
9905 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9906 or
9907 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9908 or
9909 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9910 or
9911 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9912 or
9913 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9914 or
9915 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9916 or
9917 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9918 or
9919 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9920 or
9921 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9922 or
9923 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9924 or
9925 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9926 or
9927 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9928 or
9929 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
9930 or
9931 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
9932 or
9933 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,'OK','NO') = 'NO'
9934 or
9935 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9936 or
9937 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9938 or
9939 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
9940 or
9941 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9942 or
9943 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9944 or
9945 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
9946 or
9947 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
9948 or
9949 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
9950 or
9951 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GENDER)),'x')),30) - 30,0,'OK','NO') = 'NO'
9952 or
9953 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,'OK','NO') = 'NO'
9954 or
9955 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
9956 or
9957 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
9958 or
9959 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
9960 or
9961 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
9962 or
9963 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
9964 or
9965 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
9966 or
9967 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
9968 or
9969 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
9970 or
9971 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
9972 or
9973 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
9974 or
9975 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
9976 or
9977 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
9978 or
9979 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
9980 or
9981 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
9982 or
9983 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
9984 or
9985 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
9986 or
9987 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
9988 or
9989 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE16)),'x')),150) - 150,0,'OK','NO') = 'NO'
9990 or
9991 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE17)),'x')),150) - 150,0,'OK','NO') = 'NO'
9992 or
9993 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE18)),'x')),150) - 150,0,'OK','NO') = 'NO'
9994 or
9995 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE19)),'x')),150) - 150,0,'OK','NO') = 'NO'
9996 or
9997 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PS_ATTRIBUTE20)),'x')),150) - 150,0,'OK','NO') = 'NO'
9998 or
9999 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(NATIVE_LANGUAGE)),'x')),4) - 4,0,'OK','NO') = 'NO'
10000 );
10001
10002
10003
10004 -- Cursor to check if it's B2B or B2C party type.
10005
10006 cursor b2borb2c is
10007 select import_type from ams_imp_list_headers_all
10008 where import_list_header_id = p_import_list_header_id;
10009
10010
10011 CURSOR c_b2b_date_fields is
10012 SELECT
10013 import_list_header_id,
10014 import_source_line_id,
10015 ADDRESS_EFFECTIVE_DATE,
10016 ADDRESS_EXPIRATION_DATE,
10017 DATE_OF_BIRTH,
10018 DATE_OF_DEATH,
10019 DEBARTMENTS_DATE,
10020 MARITAL_STATUS_EFFECTIVE_DATE
10021 FROM ams_hz_b2b_mapping_v
10022 WHERE import_list_header_id = p_import_list_header_id
10023 and load_status in ('ACTIVE','RELOAD')
10024 AND (ADDRESS_EFFECTIVE_DATE is not null or ADDRESS_EXPIRATION_DATE is not null or
10025 DATE_OF_BIRTH is not null or DATE_OF_DEATH is not null or DEBARTMENTS_DATE is not null
10026 or MARITAL_STATUS_EFFECTIVE_DATE is not null);
10027
10028 CURSOR c_b2c_date_fields is
10029 SELECT
10030 import_list_header_id,
10031 import_source_line_id,
10032 ADDRESS_EFFECTIVE_DATE,
10033 ADDRESS_EXPIRATION_DATE,
10034 DATE_OF_BIRTH,
10035 DATE_OF_DEATH,
10036 null date1,
10037 MARITAL_STATUS_EFFECTIVE_DATE
10038 FROM ams_hz_b2c_mapping_v
10039 WHERE import_list_header_id = p_import_list_header_id
10040 and load_status in ('ACTIVE','RELOAD')
10041 AND (ADDRESS_EFFECTIVE_DATE is not null or ADDRESS_EXPIRATION_DATE is not null or
10042 DATE_OF_BIRTH is not null or DATE_OF_DEATH is not null or MARITAL_STATUS_EFFECTIVE_DATE is not null);
10043
10044 begin
10045
10046 IF p_import_list_header_id IS NULL THEN
10047 RAISE FND_API.G_EXC_ERROR;
10048 END IF;
10049 p_return_status := FND_API.G_RET_STS_SUCCESS;
10050
10051 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_DATATYPE_ERROR_CHK');
10052 l_invalid_number := FND_MESSAGE.get;
10053 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_SIZE_ERROR_CHK');
10054 l_invalid_size := FND_MESSAGE.get;
10055 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_NULL_ERROR_CHK');
10056 l_null_value := FND_MESSAGE.get;
10057
10058 OPEN b2borb2c;
10059 FETCH b2borb2c into l_imp_type;
10060 CLOSE b2borb2c;
10061 x_b2b := l_imp_type;
10062 OPEN c_lead_batch_id;
10063 FETCH c_lead_batch_id into l_batch_id;
10064 CLOSE c_lead_batch_id;
10065
10066 if x_b2b = 'B2B' then
10067 OPEN b2b;
10068 else
10069 OPEN b2c;
10070 end if;
10071 LOOP
10072 if x_b2b = 'B2B' then
10073 FETCH b2b BULK COLLECT INTO
10074 l_import_source_line_id,
10075 l_import_list_header_id,
10076 l_col1 ,
10077 l_col2 ,
10078 l_col3 ,
10079 l_col4 ,
10080 l_col5 ,
10081 l_col6 ,
10082 l_col7 ,
10083 l_col8 ,
10084 l_col9 ,
10085 l_col10 ,
10086 l_col11 ,
10087 l_col12 ,
10088 l_col13 ,
10089 l_col14 ,
10090 l_col15 ,
10091 l_col16 ,
10092 l_col17 ,
10093 l_col18 ,
10094 l_col19 ,
10095 l_col20 ,
10096 l_col21 ,
10097 l_col22 ,
10098 l_col23 ,
10099 l_col24 ,
10100 l_col25 ,
10101 l_col26 ,
10102 l_col27 ,
10103 l_col28 ,
10104 l_col29 ,
10105 l_col30 ,
10106 l_col31 ,
10107 l_col32 ,
10108 l_col33 ,
10109 l_col34 ,
10110 l_col35 ,
10111 l_col36 ,
10112 l_col37 ,
10113 l_col38 ,
10114 l_col39 ,
10115 l_col40 ,
10116 l_col41 ,
10117 l_col42 ,
10118 l_col43 ,
10119 l_col44 ,
10120 l_col45 ,
10121 l_col46 ,
10122 l_col47 ,
10123 l_col48 ,
10124 l_col49 ,
10125 -- l_col50 ,
10126 -- l_col51 ,
10127 -- l_col52 ,
10128 l_col53 ,
10129 -- l_col54 ,
10130 l_col55 ,
10131 -- l_col56 ,
10132 -- l_col57 ,
10133 -- l_col58 ,
10134 l_col59 ,
10135 l_col60 ,
10136 l_col61 ,
10137 l_col62 ,
10138 l_col63 ,
10139 l_col64 ,
10140 l_col65 ,
10141 l_col66 ,
10142 l_col67 ,
10143 l_col68 ,
10144 l_col69 ,
10145 l_col70 ,
10146 l_col71 ,
10147 l_col72 ,
10148 l_col73 ,
10149 l_col74 ,
10150 l_col75 ,
10151 l_col76 ,
10152 l_col77 ,
10153 l_col78 ,
10154 l_col79 ,
10155 l_col80 ,
10156 l_col81 ,
10157 l_col82 ,
10158 l_col83 ,
10159 l_col84 ,
10160 l_col85 ,
10161 l_col86 ,
10162 l_col87 ,
10163 l_col88 ,
10164 l_col89 ,
10165 l_col90 ,
10166 l_col91 ,
10167 l_col92 ,
10168 l_col93 ,
10169 l_col94 ,
10170 l_col95 ,
10171 l_col96 ,
10172 l_col97 ,
10173 l_col98 ,
10174 l_col99 ,
10175 l_col100 ,
10176 l_col101 ,
10177 l_col102 ,
10178 l_col103 ,
10179 l_col104 ,
10180 l_col105 ,
10181 l_col106 ,
10182 l_col107 ,
10183 l_col108 ,
10184 l_col109 ,
10185 l_col110 ,
10186 l_col111 ,
10187 l_col112 ,
10188 l_col113 ,
10189 l_col114 ,
10190 l_col115 ,
10191 l_col116 ,
10192 l_col117 ,
10193 l_col118 ,
10194 l_col119 ,
10195 l_col120 ,
10196 l_col121 ,
10197 l_col122 ,
10198 l_col123 ,
10199 l_col124 ,
10200 l_col125 ,
10201 l_col126 ,
10202 l_col127 ,
10203 l_col128 ,
10204 l_col129 ,
10205 l_col130 ,
10206 l_col131 ,
10207 l_col132 ,
10208 l_col133 ,
10209 l_col134 ,
10210 l_col135 ,
10211 l_col136 ,
10212 l_col137 ,
10213 l_col138 ,
10214 l_col139 ,
10215 l_col140 ,
10216 l_col141 ,
10217 l_col142 ,
10218 l_col143 ,
10219 l_col144 ,
10220 l_col145 ,
10221 l_col146 ,
10222 l_col147 ,
10223 l_col148 ,
10224 l_col149 ,
10225 l_col150 ,
10226 l_col151 ,
10227 l_col152 ,
10228 l_col153 ,
10229 l_col154 ,
10230 l_col155 ,
10231 l_col156 ,
10232 l_col157 ,
10233 l_col158 ,
10234 l_col159 ,
10235 l_col160 ,
10236 l_col161 ,
10237 l_col162 ,
10238 l_col163 ,
10239 l_col164 ,
10240 l_col165 ,
10241 l_col166 ,
10242 l_col167 ,
10243 l_col168 ,
10244 l_col169 ,
10245 l_col170 ,
10246 l_col171 ,
10247 l_col172 ,
10248 l_col173 ,
10249 l_col174 ,
10250 l_col175 ,
10251 l_col176 ,
10252 l_col177 ,
10253 l_col178 ,
10254 l_col179 ,
10255 l_col180 ,
10256 l_col181 ,
10257 l_col182 ,
10258 l_col183 ,
10259 l_col184 ,
10260 l_col185 ,
10261 l_col186 ,
10262 l_col187 ,
10263 l_col188 ,
10264 l_col189 ,
10265 l_col190 ,
10266 l_col191 ,
10267 l_col192 ,
10268 l_col193 ,
10269 l_col194 ,
10270 l_col221,
10271 l_col222,
10272 l_col223,
10273 l_col224,
10274 l_col225,
10275 l_col226,
10276 l_col227,
10277 l_col228,
10278 l_col229,
10279 l_col230,
10280 l_col231,
10281 l_col232,
10282 l_col233,
10283 l_col234,
10284 l_col235,
10285 l_col236,
10286 l_col237,
10287 l_col238,
10288 l_col239,
10289 l_col240,
10290 l_col241,
10291 l_col242,
10292 l_col243,
10293 l_col244,
10294 l_col245,
10295 l_col246,
10296 l_col247,
10297 l_col248,
10298 l_col249,
10299 l_col251,
10300 l_col252,
10301 l_col253,
10302 l_col254,
10303 l_col255,
10304 l_col256,
10305 l_col257,
10306 l_col258,
10307 l_col259,
10308 l_col260,
10309 l_col261,
10310 l_col262,
10311 l_col263,
10312 l_col264,
10313 l_col265,
10314 l_col266,
10315 l_col267,
10316 l_col268,
10317 l_col269,
10318 l_col270,
10319 l_col271,
10320 l_col272,
10321 l_col273,
10322 l_col274,
10323 l_col275,
10324 l_col276,
10325 l_col277,
10326 l_col278,
10327 l_col279,
10328 l_col280,
10329 l_col281,
10330 l_col282,
10331 l_col283,
10332 l_col284,
10333 l_col285,
10334 l_col286,
10335 l_col287,
10336 l_col288,
10337 l_col289,
10338 l_col290,
10339 l_col291,
10340 l_col292,
10341 l_col293,
10342 l_col294,
10343 l_col295,
10344 l_col296,
10345 l_col297,
10346 l_col298,
10347 l_col299,
10348 l_col300,
10349 l_col301,
10350 l_col302
10351 LIMIT L_MAX_ROW_COUNT;
10352 else
10353 FETCH b2c BULK COLLECT INTO
10354 l_import_source_line_id,
10355 l_import_list_header_id,
10356 l_col1 ,
10357 l_col2 ,
10358 l_col3 ,
10359 l_col4 ,
10360 l_col5 ,
10361 l_col6 ,
10362 l_col7 ,
10363 l_col8 ,
10364 l_col9 ,
10365 l_col10 ,
10366 l_col11 ,
10367 l_col12 ,
10368 l_col13 ,
10369 l_col14 ,
10370 l_col15 ,
10371 l_col16 ,
10372 l_col17 ,
10373 l_col18 ,
10374 l_col19 ,
10375 l_col20 ,
10376 l_col21 ,
10377 l_col22 ,
10378 l_col23 ,
10379 l_col24 ,
10380 l_col25 ,
10381 l_col26 ,
10382 -- l_col27 ,
10383 -- l_col28 ,
10384 -- l_col29 ,
10385 l_col30 ,
10386 -- l_col31 ,
10387 l_col32 ,
10388 -- l_col33 ,
10389 -- l_col34 ,
10390 -- l_col35 ,
10391 l_col36 ,
10392 l_col37 ,
10393 l_col38 ,
10394 l_col39 ,
10395 l_col40 ,
10396 l_col41 ,
10397 l_col42 ,
10398 l_col43 ,
10399 l_col44 ,
10400 l_col45 ,
10401 l_col46 ,
10402 l_col47 ,
10403 l_col48 ,
10404 l_col49 ,
10405 l_col50 ,
10406 l_col51 ,
10407 l_col52 ,
10408 l_col53 ,
10409 l_col54 ,
10410 l_col55 ,
10411 l_col56 ,
10412 l_col57 ,
10413 l_col58 ,
10414 l_col59 ,
10415 l_col60 ,
10416 l_col61 ,
10417 l_col62 ,
10418 l_col63 ,
10419 l_col64 ,
10420 l_col65 ,
10421 l_col66 ,
10422 l_col67 ,
10423 l_col68 ,
10424 l_col69 ,
10425 l_col70 ,
10426 l_col71 ,
10427 l_col72 ,
10428 l_col73 ,
10429 l_col74 ,
10430 l_col75 ,
10431 l_col76 ,
10432 l_col77 ,
10433 l_col78 ,
10434 l_col79 ,
10435 l_col80 ,
10436 l_col81 ,
10437 l_col82 ,
10438 l_col83 ,
10439 l_col84 ,
10440 l_col85 ,
10441 l_col86 ,
10442 l_col87 ,
10443 l_col88 ,
10444 l_col89 ,
10445 l_col90 ,
10446 l_col91 ,
10447 l_col92 ,
10448 l_col93 ,
10449 l_col94 ,
10450 l_col95 ,
10451 l_col96 ,
10452 l_col97 ,
10453 l_col98 ,
10454 l_col99 ,
10455 l_col100 ,
10456 l_col101 ,
10457 l_col102 ,
10458 l_col103 ,
10459 l_col104 ,
10460 l_col105 ,
10461 l_col106 ,
10462 l_col107 ,
10463 l_col108 ,
10464 l_col109 ,
10465 l_col110 ,
10466 l_col111 ,
10467 l_col112 ,
10468 l_col113 ,
10469 l_col114 ,
10470 l_col115 ,
10471 l_col116 ,
10472 l_col117 ,
10473 l_col118 ,
10474 l_col119 ,
10475 l_col120 ,
10476 l_col121 ,
10477 l_col122 ,
10478 l_col123 ,
10479 l_col124 ,
10480 l_col125 ,
10481 l_col126 ,
10482 l_col127 ,
10483 l_col128 ,
10484 l_col129 ,
10485 l_col130 ,
10486 l_col131 ,
10487 l_col132 ,
10488 l_col133 ,
10489 l_col134 ,
10490 l_col135 ,
10491 l_col136 ,
10492 l_col137 ,
10493 l_col138 ,
10494 l_col139 ,
10495 l_col140 ,
10496 l_col141 ,
10497 l_col142 ,
10498 l_col143 ,
10499 l_col144 ,
10500 l_col145 ,
10501 l_col146 ,
10502 l_col147 ,
10503 l_col148 ,
10504 l_col149 ,
10505 l_col150 ,
10506 l_col151 ,
10507 l_col152 ,
10508 l_col153 ,
10509 l_col154 ,
10510 l_col155 ,
10511 l_col156 ,
10512 l_col157 ,
10513 l_col158 ,
10514 l_col159 ,
10515 l_col160 ,
10516 l_col161 ,
10517 l_col162 ,
10518 l_col163 ,
10519 l_col164 ,
10520 l_col165 ,
10521 l_col166 ,
10522 l_col167 ,
10523 l_col168 ,
10524 l_col169 ,
10525 l_col170 ,
10526 l_col171 ,
10527 l_col172 ,
10528 l_col173 ,
10529 l_col174 ,
10530 l_col175 ,
10531 l_col176 ,
10532 l_col177 ,
10533 l_col178 ,
10534 l_col179 ,
10535 l_col180 ,
10536 l_col181 ,
10537 l_col182 ,
10538 l_col183 ,
10539 l_col184 ,
10540 l_col185 ,
10541 l_col186 ,
10542 l_col187 ,
10543 l_col188 ,
10544 l_col189 ,
10545 l_col190 ,
10546 l_col191 ,
10547 l_col192 ,
10548 l_col193 ,
10549 l_col194 ,
10550 l_col221,
10551 l_col222,
10552 l_col223,
10553 l_col224,
10554 l_col225,
10555 l_col226,
10556 l_col227,
10557 l_col228,
10558 l_col229,
10559 l_col230,
10560 l_col231,
10561 l_col232,
10562 l_col233,
10563 l_col234,
10564 l_col235,
10565 l_col236,
10566 l_col237,
10567 l_col238,
10568 l_col239,
10569 l_col240,
10570 l_col241,
10571 l_col242,
10572 l_col243,
10573 l_col244,
10574 l_col245,
10575 l_col246,
10576 l_col247,
10577 l_col248,
10578 l_col249,
10579 l_col251,
10580 l_col252,
10581 l_col253,
10582 l_col254,
10583 l_col255,
10584 l_col256,
10585 l_col257,
10586 l_col258,
10587 l_col259,
10588 l_col260,
10589 l_col261,
10590 l_col262,
10591 l_col263,
10592 l_col264,
10593 l_col265,
10594 l_col266,
10595 l_col267,
10596 l_col268,
10597 l_col269,
10598 l_col270,
10599 l_col271,
10600 l_col272,
10601 l_col273,
10602 l_col274,
10603 l_col275,
10604 l_col276,
10605 l_col277,
10606 l_col278,
10607 l_col279,
10608 l_col280,
10609 l_col281,
10610 l_col282,
10611 l_col283,
10612 l_col284,
10613 l_col285,
10614 l_col286,
10615 l_col287,
10616 l_col288,
10617 l_col289,
10618 l_col290,
10619 l_col291,
10620 l_col292,
10621 l_col293,
10622 l_col294,
10623 l_col295,
10624 l_col296,
10625 l_col297,
10626 l_col298,
10627 l_col299,
10628 l_col300,
10629 l_col301,
10630 l_col302
10631 LIMIT L_MAX_ROW_COUNT;
10632 end if;
10633
10634 FORALL i IN 1 .. l_import_source_line_id.count
10635 INSERT INTO ams_list_import_errors
10636 (
10637 LIST_IMPORT_ERROR_ID,
10638 LAST_UPDATED_BY,
10639 LAST_UPDATE_DATE,
10640 CREATION_DATE,
10641 CREATED_BY,
10642 LAST_UPDATE_LOGIN,
10643 IMPORT_SOURCE_LINE_ID,
10644 IMPORT_LIST_HEADER_ID,
10645 IMPORT_TYPE,
10646 ERROR_TYPE,
10647 batch_id,
10648 error_flag,
10649 col1 ,
10650 col2 ,
10651 col3 ,
10652 col4 ,
10653 col5 ,
10654 col6 ,
10655 col7 ,
10656 col8 ,
10657 col9 ,
10658 col10 ,
10659 col11 ,
10660 col12 ,
10661 col13 ,
10662 col14 ,
10663 col15 ,
10664 col16 ,
10665 col17 ,
10666 col18 ,
10667 col19 ,
10668 col20 ,
10669 col21 ,
10670 col22 ,
10671 col23 ,
10672 col24 ,
10673 col25 ,
10674 col26 ,
10675 col27 ,
10676 col28 ,
10677 col29 ,
10678 col30 ,
10679 col31 ,
10680 col32 ,
10681 col33 ,
10682 col34 ,
10683 col35 ,
10684 col36 ,
10685 col37 ,
10686 col38 ,
10687 col39 ,
10688 col40 ,
10689 col41 ,
10690 col42 ,
10691 col43 ,
10692 col44 ,
10693 col45 ,
10694 col46 ,
10695 col47 ,
10696 col48 ,
10697 col49 ,
10698 -- col50 ,
10699 --col51 ,
10700 --col52 ,
10701 col53 ,
10702 --col54 ,
10703 col55 ,
10704 --col56 ,
10705 --col57 ,
10706 --col58 ,
10707 col59 ,
10708 col60 ,
10709 col61 ,
10710 col62 ,
10711 col63 ,
10712 col64 ,
10713 col65 ,
10714 col66 ,
10715 col67 ,
10716 col68 ,
10717 col69 ,
10718 col70 ,
10719 col71 ,
10720 col72 ,
10721 col73 ,
10722 col74 ,
10723 col75 ,
10724 col76 ,
10725 col77 ,
10726 col78 ,
10727 col79 ,
10728 col80 ,
10729 col81 ,
10730 col82 ,
10731 col83 ,
10732 col84 ,
10733 col85 ,
10734 col86 ,
10735 col87 ,
10736 col88 ,
10737 col89 ,
10738 col90 ,
10739 col91 ,
10740 col92 ,
10741 col93 ,
10742 col94 ,
10743 col95 ,
10744 col96 ,
10745 col97 ,
10746 col98 ,
10747 col99 ,
10748 col100 ,
10749 col101 ,
10750 col102 ,
10751 col103 ,
10752 col104 ,
10753 col105 ,
10754 col106 ,
10755 col107 ,
10756 col108 ,
10757 col109 ,
10758 col110 ,
10759 col111 ,
10760 col112 ,
10761 col113 ,
10762 col114 ,
10763 col115 ,
10764 col116 ,
10765 col117 ,
10766 col118 ,
10767 col119 ,
10768 col120 ,
10769 col121 ,
10770 col122 ,
10771 col123 ,
10772 col124 ,
10773 col125 ,
10774 col126 ,
10775 col127 ,
10776 col128 ,
10777 col129 ,
10778 col130 ,
10779 col131 ,
10780 col132 ,
10781 col133 ,
10782 col134 ,
10783 col135 ,
10784 col136 ,
10785 col137 ,
10786 col138 ,
10787 col139 ,
10788 col140 ,
10789 col141 ,
10790 col142 ,
10791 col143 ,
10792 col144 ,
10793 col145 ,
10794 col146 ,
10795 col147 ,
10796 col148 ,
10797 col149 ,
10798 col150 ,
10799 col151 ,
10800 col152 ,
10801 col153 ,
10802 col154 ,
10803 col155 ,
10804 col156 ,
10805 col157 ,
10806 col158 ,
10807 col159 ,
10808 col160 ,
10809 col161 ,
10810 col162 ,
10811 col163 ,
10812 col164 ,
10813 col165 ,
10814 col166 ,
10815 col167 ,
10816 col168 ,
10817 col169 ,
10818 col170 ,
10819 col171 ,
10820 col172 ,
10821 col173 ,
10822 col174 ,
10823 col175 ,
10824 col176 ,
10825 col177 ,
10826 col178 ,
10827 col179 ,
10828 col180 ,
10829 col181 ,
10830 col182 ,
10831 col183 ,
10832 col184 ,
10833 col185 ,
10834 col186 ,
10835 col187 ,
10836 col188 ,
10837 col189 ,
10838 col190 ,
10839 col191 ,
10840 col192 ,
10841 col193 ,
10842 col194
10843 )
10844 VALUES
10845 (
10846 ams_list_import_errors_s.nextval, -- LIST_IMPORT_ERROR_ID,
10847 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
10848 SYSDATE, -- LAST_UPDATE_DATE,
10849 SYSDATE, -- CREATION_DATE,
10850 FND_GLOBAL.User_ID, -- CREATED_BY,
10851 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
10852 l_import_source_line_id(i),
10853 l_import_list_header_id(i),
10854 l_imp_type, -- 'CUSTOMER', -- IMPORT_TYPE,
10855 'E', -- ERROR_TYPE,
10856 l_batch_id,
10857 'Y',
10858 l_col1(i),
10859 l_col2(i),
10860 l_col3(i),
10861 l_col4(i),
10862 l_col5(i),
10863 l_col6(i),
10864 l_col7(i),
10865 l_col8(i),
10866 l_col9(i),
10867 l_col10(i),
10868 l_col11(i),
10869 l_col12(i),
10870 l_col13(i),
10871 l_col14(i),
10872 l_col15(i),
10873 l_col16(i),
10874 l_col17(i),
10875 l_col18(i),
10876 l_col19(i),
10877 l_col20(i),
10878 l_col21(i),
10879 l_col22(i),
10880 l_col23(i),
10881 l_col24(i),
10882 l_col25(i),
10883 l_col26(i),
10884 l_col27(i),
10885 l_col28(i),
10886 l_col29(i),
10887 l_col30(i),
10888 l_col31(i),
10889 l_col32(i),
10890 l_col33(i),
10891 l_col34(i),
10892 l_col35(i),
10893 l_col36(i),
10894 l_col37(i),
10895 l_col38(i),
10896 l_col39(i),
10897 l_col40(i),
10898 l_col41(i),
10899 l_col42(i),
10900 l_col43(i),
10901 l_col44(i),
10902 l_col45(i),
10903 l_col46(i),
10904 l_col47(i),
10905 l_col48(i),
10906 l_col49(i),
10907 -- l_col50(i),
10908 -- l_col51(i),
10909 -- l_col52(i),
10910 l_col53(i),
10911 -- l_col54(i),
10912 l_col55(i),
10913 -- l_col56(i),
10914 -- l_col57(i),
10915 --l_col58(i),
10916 l_col59(i),
10917 l_col60(i),
10918 l_col61(i),
10919 l_col62(i),
10920 l_col63(i),
10921 l_col64(i),
10922 l_col65(i),
10923 l_col66(i),
10924 l_col67(i),
10925 l_col68(i),
10926 l_col69(i),
10927 l_col70(i),
10928 l_col71(i),
10929 l_col72(i),
10930 l_col73(i),
10931 l_col74(i),
10932 l_col75(i),
10933 l_col76(i),
10934 l_col77(i),
10935 l_col78(i),
10936 l_col79(i),
10937 l_col80(i),
10938 l_col81(i),
10939 l_col82(i),
10940 l_col83(i),
10941 l_col84(i),
10942 l_col85(i),
10943 l_col86(i),
10944 l_col87(i),
10945 l_col88(i),
10946 l_col89(i),
10947 l_col90(i),
10948 l_col91(i),
10949 l_col92(i),
10950 l_col93(i),
10951 l_col94(i),
10952 l_col95(i),
10953 l_col96(i),
10954 l_col97(i),
10955 l_col98(i),
10956 l_col99(i),
10957 l_col100(i),
10958 l_col101(i),
10959 l_col102(i),
10960 l_col103(i),
10961 l_col104(i),
10962 l_col105(i),
10963 l_col106(i),
10964 l_col107(i),
10965 l_col108(i),
10966 l_col109(i),
10967 l_col110(i),
10968 l_col111(i),
10969 l_col112(i),
10970 l_col113(i),
10971 l_col114(i),
10972 l_col115(i),
10973 l_col116(i),
10974 l_col117(i),
10975 l_col118(i),
10976 l_col119(i),
10977 l_col120(i),
10978 l_col121(i),
10979 l_col122(i),
10980 l_col123(i),
10981 l_col124(i),
10982 l_col125(i),
10983 l_col126(i),
10984 l_col127(i),
10985 l_col128(i),
10986 l_col129(i),
10987 l_col130(i),
10988 l_col131(i),
10989 l_col132(i),
10990 l_col133(i),
10991 l_col134(i),
10992 l_col135(i),
10993 l_col136(i),
10994 l_col137(i),
10995 l_col138(i),
10996 l_col139(i),
10997 l_col140(i),
10998 l_col141(i),
10999 l_col142(i),
11000 l_col143(i),
11001 l_col144(i),
11002 l_col145(i),
11003 l_col146(i),
11004 l_col147(i),
11005 l_col148(i),
11006 l_col149(i),
11007 l_col150(i),
11008 l_col151(i),
11009 l_col152(i),
11010 l_col153(i),
11011 l_col154(i),
11012 l_col155(i),
11013 l_col156(i),
11014 l_col157(i),
11015 l_col158(i),
11016 l_col159(i),
11017 l_col160(i),
11018 l_col161(i),
11019 l_col162(i),
11020 l_col163(i),
11021 l_col164(i),
11022 l_col165(i),
11023 l_col166(i),
11024 l_col167(i),
11025 l_col168(i),
11026 l_col169(i),
11027 l_col170(i),
11028 l_col171(i),
11029 l_col172(i),
11030 l_col173(i),
11031 l_col174(i),
11032 l_col175(i),
11033 l_col176(i),
11034 l_col177(i),
11035 l_col178(i),
11036 l_col189(i),
11037 l_col180(i),
11038 l_col181(i),
11039 l_col182(i),
11040 l_col183(i),
11041 l_col184(i),
11042 l_col185(i),
11043 l_col186(i),
11044 l_col187(i),
11045 l_col188(i),
11046 l_col189(i),
11047 l_col190(i),
11048 l_col191(i),
11049 l_col192(i),
11050 l_col193(i),
11051 l_col194(i)
11052 );
11053 if x_b2b = 'B2B' then
11054 EXIT WHEN b2b%NOTFOUND;
11055 else
11056 EXIT WHEN b2c%NOTFOUND;
11057 end if;
11058 END LOOP;
11059 if x_b2b = 'B2B' then
11060 CLOSE b2b;
11061 else
11062 CLOSE b2c;
11063 end if;
11064 if x_b2b = 'B2B' then
11065 OPEN c_b2b_date_fields;
11066 LOOP
11067 FETCH c_b2b_date_fields into x_import_list_header_id,x_import_source_line_id,l_ADDRESS_EFFECTIVE_DATE,
11068 l_ADDRESS_EXPIRATION_DATE,l_DATE_OF_BIRTH,l_DATE_OF_DEATH,l_DEBARTMENTS_DATE,
11069 l_MARITAL_STATUS_EFF_DATE;
11070 EXIT WHEN c_b2b_date_fields%NOTFOUND;
11071 date_validate( x_import_list_header_id,x_import_source_line_id,l_batch_id,l_ADDRESS_EFFECTIVE_DATE,
11072 l_ADDRESS_EXPIRATION_DATE, l_DATE_OF_BIRTH,l_DATE_OF_DEATH,l_DEBARTMENTS_DATE,l_MARITAL_STATUS_EFF_DATE);
11073 End Loop;
11074 CLOSE c_b2b_date_fields;
11075 end if;
11076 if x_b2b = 'B2C' then
11077 OPEN c_b2c_date_fields;
11078 LOOP
11079 FETCH c_b2c_date_fields into x_import_list_header_id,x_import_source_line_id,l_ADDRESS_EFFECTIVE_DATE,
11080 l_ADDRESS_EXPIRATION_DATE,l_DATE_OF_BIRTH,l_DATE_OF_DEATH,l_DEBARTMENTS_DATE,
11081 l_MARITAL_STATUS_EFF_DATE;
11082 EXIT WHEN c_b2c_date_fields%NOTFOUND;
11083 date_validate( x_import_list_header_id,x_import_source_line_id,l_batch_id,l_ADDRESS_EFFECTIVE_DATE,
11084 l_ADDRESS_EXPIRATION_DATE, l_DATE_OF_BIRTH,l_DATE_OF_DEATH,null,l_MARITAL_STATUS_EFF_DATE);
11085 End Loop;
11086 CLOSE c_b2c_date_fields;
11087 end if;
11088 UPDATE ams_imp_source_lines
11089 SET load_status = decode(load_status,'DUPLICATE','DUPLICATE','ERROR')
11090 WHERE import_list_header_id = p_import_list_header_id
11091 and import_source_line_id in
11092 (select import_source_line_id from ams_list_import_errors
11093 where import_list_header_id = p_import_list_header_id
11094 and error_type = 'E');
11095
11096 EXCEPTION
11097 WHEN OTHERS THEN
11098 p_return_status := FND_API.G_RET_STS_ERROR;
11099 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
11100 FND_MESSAGE.Set_Token('ROW','Error in execute_cust_data_validation:' || SQLERRM||' '||SQLCODE);
11101 AMS_Utility_PVT.Create_Log (
11102 x_return_status => l_return_status,
11103 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
11104 p_log_used_by_id => p_import_list_header_id,
11105 p_msg_data => FND_MESSAGE.get,
11106 p_msg_type => 'DEBUG'
11107 );
11108
11109 end execute_cust_data_validation;
11110 -- ----------------------------------------------
11111
11112
11113
11114 --
11115 -- This program performs error checks in ams_import_interface table.
11116
11117 PROCEDURE exe_custxml_data_validation (
11118 p_import_list_header_id NUMBER,
11119 p_return_status OUT NOCOPY VARCHAR2
11120 ) IS
11121 l_batch_id NUMBER;
11122 l_import_list_header_id number;
11123 l_import_source_line_id number;
11124 l_invalid_number varchar2(4000) ;
11125 l_invalid_size varchar2(4000) ;
11126 l_null_value varchar2(4000) ;
11127 x_b2b varchar(30);
11128 l_return_status varchar(1);
11129 l_imp_type varchar2(60);
11130
11131 l_cust_b2b_rec data_in_rec_type;
11132 l_cust_b2c_rec data_in_rec_b2c_type;
11133
11134
11135 CURSOR c_lead_batch_id is
11136 SELECT
11137 batch_id
11138 FROM ams_imp_list_headers_all
11139 WHERE import_list_header_id = p_import_list_header_id;
11140
11141 -- Cursor for B2B party type
11142
11143 cursor b2b is
11144 SELECT
11145 IMPORT_SOURCE_LINE_ID,
11146 import_list_header_id,
11147 org_imp_xml_element_id,
11148 add_imp_xml_element_id,
11149 ocont_imp_xml_element_id,
11150 cp_imp_xml_element_id,
11151 em_imp_xml_element_id,
11152 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PARTY_NAME))),255) - 255,0,' ','PARTY_NAME :'||decode(nvl(PARTY_NAME,'x'),'x',l_null_value,l_invalid_size)||'(255)') PARTY_NAME,
11153 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FISCAL_YEAREND_MONTH)),'x')),30) - 30,0,' ','FISCAL_YEAREND_MONTH :'||l_invalid_size||'(30)') FISCAL_YEAREND_MONTH,
11154 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DUNS_NUMBER,' ','x'))),'0123456789.', 'x'))),0),0,' ','DUNS_NUMBER :'||l_invalid_number) DUNS_NUMBER,
11155 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(EMPLOYEES_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,' ','EMPLOYEES_TOTAL :'||l_invalid_number) EMPLOYEES_TOTAL,
11156 DECODE(GREATEST(lengthb(nvl(LINE_OF_BUSINESS,'x')),240) - 240,0,' ','LINE_OF_BUSINESS :'||l_invalid_size) LINE_OF_BUSINESS,
11157 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,' ','ADDRESS1 :'||l_invalid_size||'(240)') ADDRESS1,
11158 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,' ','ADDRESS2 :'||l_invalid_size||'(240)') ADDRESS2,
11159 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,' ','ADDRESS3 :'||l_invalid_size||'(240)') ADDRESS3,
11160 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,' ','ADDRESS4 :'||l_invalid_size||'(240)') ADDRESS4,
11161 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(YEAR_ESTABLISHED,' ','x'))),'0123456789.',' x'))),0),0,' ','YEAR_ESTABLISHED :'||l_invalid_number) YEAR_ESTABLISHED,
11162 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),50) - 50,0,' ','TAX_REFERENCE :'||l_invalid_size||'(50)') TAX_REFERENCE,
11163 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CEO_NAME)),'x')),240) - 240,0,' ','CEO_NAME :'||l_invalid_size||'(240)') CEO_NAME,
11164 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME)),'x')),50) - 50,0,' ','PERSON_LAST_NAME :'||l_invalid_size||'(50)') PERSON_LAST_NAME,
11165 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME)),'x')),40) - 40,0,' ','PERSON_FIRST_NAME :'||l_invalid_size||'(40)') PERSON_FIRST_NAME,
11166 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,' ','PERSON_NAME_PREFIX :'||l_invalid_size||'(30)') PERSON_NAME_PREFIX,
11167 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE)),'x')),100) - 100,0,' ','JOB_TITLE :'||l_invalid_size||'(100)') JOB_TITLE,
11168 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,' ','PERSON_MIDDLE_NAME :'||l_invalid_size||'(60)') PERSON_MIDDLE_NAME,
11169 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,' ','PERSON_NAME_SUFFIX :'||l_invalid_size||'(30)') PERSON_NAME_SUFFIX,
11170 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,' ','CITY :'||l_invalid_size||'(60)') CITY ,
11171 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,' ','POSTAL_CODE :'||l_invalid_size||'(60)') POSTAL_CODE,
11172 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,' ','STATE :'||l_invalid_size||'(60)') STATE,
11173 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,' ','PROVINCE :'||l_invalid_size||'(60)') PROVINCE,
11174 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,' ','COUNTY :'||l_invalid_size||'(60)') COUNTY,
11175 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,' ','COUNTRY :'||l_invalid_size||'(60)') COUNTRY,
11176 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,' ','EMAIL_ADDRESS :'||l_invalid_size||'(240)') EMAIL_ADDRESS,
11177 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,' ','PHONE_COUNTRY_CODE :'||l_invalid_size||'(30)') PHONE_COUNTRY_CODE,
11178 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,' ','PHONE_AREA_CODE :'||l_invalid_size||'(10)') PHONE_AREA_CODE,
11179 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,' ','PHONE_NUMBER :'||l_invalid_size||'(25)') PHONE_NUMBER,
11180 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,' ','PHONE_EXTENTION :'||l_invalid_size||'(20)') PHONE_EXTENTION,
11181 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT)),'x')),60) - 60,0,' ','DEPARTMENT :'||l_invalid_size||'(60)') DEPARTMENT,
11182 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,' ','DECISION_MAKER_FLAG :'||l_invalid_size||'(1)') DECISION_MAKER_FLAG,
11183 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE)),'x')),30) - 30,0,' ','SIC_CODE :'||l_invalid_size||'(30)') SIC_CODE,
11184 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SIC_CODE_TYPE)),'x')),30) - 30,0,' ','SIC_CODE_TYPE :'||l_invalid_size||'(30)') SIC_CODE_TYPE,
11185 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ANALYSIS_FY)),'x')),5) - 5,0,' ','ANALYSIS_FY :'||l_invalid_size||'(5)') ANALYSIS_FY,
11186 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CURR_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,' ','CURR_FY_POTENTIAL_REVENUE :'||l_invalid_number) CURR_FY_POTENTIAL_REVENUE,
11187 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(NEXT_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,' ','NEXT_FY_POTENTIAL_REVENUE :'||l_invalid_number) NEXT_FY_POTENTIAL_REVENUE,
11188 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GSA_INDICATOR_FLAG)),'x')),1) - 1,0,' ','GSA_INDICATOR_FLAG :'||l_invalid_size||'(1)') GSA_INDICATOR_FLAG,
11189 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,' ','identifying_address_flag :'||l_invalid_size||'(1)') identifying_address_flag,
11190 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MISSION_STATEMENT)),'x')),2000) - 2000,0,' ','MISSION_STATEMENT :'||l_invalid_size||'(2000)') MISSION_STATEMENT,
11191 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_NAME_PHONETIC)),'x')),320) - 320,0,' ','ORGANIZATION_NAME_PHONETIC :'||l_invalid_size||'(320)') ORGANIZATION_NAME_PHONETIC,
11192 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CATEGORY_CODE)),'x')),30) -30,0,' ','CATEGORY_CODE:'||l_invalid_size||'(30)') CATEGORY_CODE,
11193 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JGZZ_FISCAL_CODE)),'x')),20) - 20,0,' ','JGZZ_FISCAL_CODE :'||l_invalid_size||'(20)') JGZZ_FISCAL_CODE,
11194 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,' ','ADDRESS_LINES_PHONETIC :'||l_invalid_size||'(560)') ADDRESS_LINES_PHONETIC,
11195 -- bug 4641591: columns obsolete
11196 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,' ','PO_BOX_NUMBER :'||l_invalid_size||'(50)') PO_BOX_NUMBER,
11197 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,' ','FLOOR :'||l_invalid_size||'(50)') FLOOR,
11198 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,' ','HOUSE_NUMBER :'||l_invalid_size||'(50)') HOUSE_NUMBER,
11199 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),10) - 10,0,' ','POSTAL_PLUS4_CODE :'||l_invalid_size||'(10)') POSTAL_PLUS4_CODE,
11200 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,' ','STREET_SUFFIX :'||l_invalid_size||'(50)') STREET_SUFFIX,
11201 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,' ','STREET :'||l_invalid_size||'(50)') STREET,
11202 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,' ','STREET_NUMBER :'||l_invalid_size||'(50)') STREET_NUMBER,
11203 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SUITE)),'x')),50) - 50,0,' ','SUITE :'||l_invalid_size||'(50)') SUITE,
11204 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,' ','PARTY_ID :'||l_invalid_number) party_id,
11205 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_URL)),'x')),2000) - 2000,0,' ','ORGANIZATION_URL :'||l_invalid_size||'(2000)') ORGANIZATION_URL,
11206 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BRANCH_FLAG)),'x')),1) - 1,0,' ','BRANCH_FLAG :'||l_invalid_size||'(1)') BRANCH_FLAG,
11207 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_LINE)),'x')),240) - 240,0,' ','BUSINESS_LINE :'||l_invalid_size||'(240)') BUSINESS_LINE,
11208 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_SCOPE)),'x')),20) - 20,0,' ','BUSINESS_SCOPE :'||l_invalid_size||'(20)') BUSINESS_SCOPE,
11209 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CHIEF_EXECUTIVE_TITLE)),'x')),240) - 240,0,' ','CHIEF_EXECUTIVE_TITLE :'||l_invalid_size||'(240)') CHIEF_EXECUTIVE_TITLE,
11210 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONGRESSIONAL_DISTRICT_CODE)),'x')),2) - 2,0,' ','CONGRESSIONAL_DISTRICT_CODE :'||l_invalid_size||'(2)') CONGRESSIONAL_DISTRICT_CODE,
11211 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CORPORATION_CLASS)),'x')),60) - 60,0,' ','CORPORATION_CLASS :'||l_invalid_size||'(60)') CORPORATION_CLASS,
11212 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE)),'x')),30) - 30,0,' ','CREDIT_SCORE :'||l_invalid_size||'(30)') CREDIT_SCORE,
11213 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE_COMMENTARY)),'x')),30) - 30,0,' ','CREDIT_SCORE_COMMENTARY :'||l_invalid_size||'(30)') CREDIT_SCORE_COMMENTARY,
11214 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DB_RATING)),'x')),5) - 5,0,' ','DB_RATING :'||l_invalid_size||'(5)') DB_RATING,
11215 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,' ','DECLARED_ETHNICITY :'||l_invalid_size||'(60)') DECLARED_ETHNICITY,
11216 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT_INDICATOR)),'x')),30) - 30,0,' ','DEPARTMENT_INDICATOR :'||l_invalid_size||'(30)') DEPARTMENT_INDICATOR,
11217 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION:'||l_invalid_size||'(2000)') DESCRIPTION,
11218 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DISADVANTAGED_INDICATOR)),'x')),30) - 30,0,' ','DISADVANTAGED_INDICATOR :'||l_invalid_size||'(30)') DISADVANTAGED_INDICATOR,
11219 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ENQUIRY_DUNS)),'x')),15) - 15,0,' ','ENQUIRY_DUNS :'||l_invalid_size||'(15)') ENQUIRY_DUNS,
11220 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EXPORT_INDICATOR)),'x')),30) - 30,0,' ','EXPORT_INDICATOR :'||l_invalid_size||'(30)') EXPORT_INDICATOR,
11221 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE)),'x')),30) - 30,0,' ','FAILURE_SCORE :'||l_invalid_size||'(30)') FAILURE_SCORE,
11222 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_COMMENTARY)),'x')),30) - 30,0,' ','FAILURE_SCORE_COMMENTARY :'||l_invalid_size||'(30)') FAILURE_SCORE_COMMENTARY,
11223 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_OVERRIDE_CODE)),'x')),30) - 30,0,' ','FAILURE_SCORE_OVERRIDE_CODE :'||l_invalid_size||'(30)') FAILURE_SCORE_OVERRIDE_CODE,
11224 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GLOBAL_FAILURE_SCORE)),'x')),5) - 5,0,' ','GLOBAL_FAILURE_SCORE :'||l_invalid_size||'(5)') GLOBAL_FAILURE_SCORE,
11225 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEADQUARTER_BRANCH_INDICATOR)),'x')),30) - 30,0,' ','HEADQUARTER_BRANCH_INDICATOR :'||l_invalid_size||'(30)') HEADQUARTER_BRANCH_INDICATOR,
11226 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEAD_OF_HOUSEHOLD_FLAG)),'x')),1) - 1,0,' ','HEAD_OF_HOUSEHOLD_FLAG :'||l_invalid_size||'(1)') HEAD_OF_HOUSEHOLD_FLAG,
11227 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(IMPORT_INDICATOR)),'x')),30) - 30,0,' ','IMPORT_INDICATOR :'||l_invalid_size||'(30)') IMPORT_INDICATOR,
11228 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS,
11229 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS2)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS2 :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS2,
11230 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS3)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS3 :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS3,
11231 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS4)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS4 :'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS4,
11232 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS5)),'x')),240) - 240,0,' ','ORGANIZATION_KNOWN_AS5:'||l_invalid_size||'(240)') ORGANIZATION_KNOWN_AS5,
11233 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS :'||l_invalid_size||'(240)') PERSON_KNOWN_AS,
11234 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS2 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS2,
11235 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS3 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS3,
11236 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS4 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS4,
11237 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS5 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS5,
11238 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LABOR_SURPLUS_INDICATOR)),'x')),30) - 30,0,' ','LABOR_SURPLUS_INDICATOR :'||l_invalid_size||'(30)') LABOR_SURPLUS_INDICATOR,
11239 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE)),'x')),30) - 30,0,' ','LOCAL_ACTIVITY_CODE :'||l_invalid_size||'(30)') LOCAL_ACTIVITY_CODE,
11240 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE_TYPE)),'x')),30) - 30,0,' ','LOCAL_ACTIVITY_CODE_TYPE :'||l_invalid_size||'(30)') LOCAL_ACTIVITY_CODE_TYPE,
11241 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,' ','LOCATION_DIRECTIONS :'||l_invalid_size||'(640)') LOCATION_DIRECTIONS,
11242 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,' ','MARITAL_STATUS :'||l_invalid_size||'(30)') MARITAL_STATUS,
11243 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_INDICATOR)),'x')),30) - 30,0,' ','MINORITY_OWNED_INDICATOR :'||l_invalid_size||'(30)') MINORITY_OWNED_INDICATOR,
11244 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_TYPE)),'x')),30) - 30,0,' ','MINORITY_OWNED_TYPE :'||l_invalid_size||'(30)') MINORITY_OWNED_TYPE,
11245 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_TYPE)),'x')),30) - 30,0,' ','ORGANIZATION_TYPE :'||l_invalid_size||'(30)') ORGANIZATION_TYPE,
11246 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OUT_OF_BUSINESS_INDICATOR)),'x')),30) - 30,0,' ','OUT_OF_BUSINESS_INDICATOR :'||l_invalid_size||'(30)') OUT_OF_BUSINESS_INDICATOR,
11247 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,' ','PERSON_ACADEMIC_TITLE :'||l_invalid_size||'(30)') PERSON_ACADEMIC_TITLE,
11248 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_FIRST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_FIRST_NAME_PHONETIC,
11249 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_LAST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_LAST_NAME_PHONETIC,
11250 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,' ','MIDDLE_NAME_PHONETIC :'||l_invalid_size||'(60)') MIDDLE_NAME_PHONETIC,
11251 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),320) - 320,0,' ','PERSON_NAME_PHONETIC :'||l_invalid_size||'(320)') PERSON_NAME_PHONETIC,
11252 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,' ','PERSON_PREVIOUS_TITLE_NAME :'||l_invalid_size||'(150)') PERSON_PREVIOUS_TITLE_NAME,
11253 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PLACE_OF_BIRTH)),'x')),60) - 60,0,' ','PLACE_OF_BIRTH :'||l_invalid_size||'(60)') PLACE_OF_BIRTH,
11254 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_NAME)),'x')),240) - 240,0,' ','PRINCIPAL_NAME :'||l_invalid_size||'(240)') PRINCIPAL_NAME,
11255 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_TITLE)),'x')),240) - 240,0,' ','PRINCIPAL_TITLE :'||l_invalid_size||'(240)') PRINCIPAL_TITLE,
11256 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PUBLIC_PRIVATE_OWNERSHIP_FLAG)),'x')),1) - 1,0,' ','PUBLIC_PRIVATE_OWNERSHIP_FLAG :'||l_invalid_size||'(1)') PUBLIC_PRIVATE_OWNERSHIP_FLAG,
11257 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,' ','RENT_OWNED_INDICATOR :'||l_invalid_size||'(30)') RENT_OWNED_INDICATOR,
11258 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,
11259 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SMALL_BUSINESS_INDICATOR)),'x')),30) - 30,0,' ','SMALL_BUSINESS_INDICATOR :'||l_invalid_size||'(30)') SMALL_BUSINESS_INDICATOR,
11260 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_ID)),'x')),60) - 60,0,' ','TAX_ID :'||l_invalid_size||'(60)') TAX_ID,
11261 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(WOMAN_OWNED_INDICATOR)),'x')),30) - 30,0,' ',' WOMAN_OWNED_INDICATOR :'||l_invalid_size||'(30)') WOMAN_OWNED_INDICATOR,
11262 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE1,
11263 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE2,
11264 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE3,
11265 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE4,
11266 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE5,
11267 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE6,
11268 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE7,
11269 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE8,
11270 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE9,
11271 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE10,
11272 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE11)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE11 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE11,
11273 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE12,
11274 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE13,
11275 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE14,
11276 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORGANIZATION_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORGANIZATION_ATTRIBUTE15,
11277 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE1)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE1 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE1,
11278 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE2)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE2 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE2,
11279 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE3)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE3 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE3,
11280 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE4)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE4 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE4,
11281 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE5)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE5 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE5,
11282 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE6)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE6 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE6,
11283 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE7)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE7 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE7,
11284 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE8)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE8 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE8,
11285 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE9)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE9 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE9,
11286 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE10)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE10 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE10,
11287 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE11,
11288 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE13)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE13 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE13,
11289 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE14)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE14 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE14,
11290 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE15)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE15 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE15,
11291 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE12)),'x')),150) - 150,0,' ','ORG_CONTACT_ATTRIBUTE12 :'||l_invalid_size||'(150)') ORG_CONTACT_ATTRIBUTE12,
11292 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE1 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE1,
11293 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE2 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE2,
11294 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE3 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE3,
11295 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE4 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE4,
11296 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE5 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE5,
11297 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE6 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE6,
11298 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE7 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE7,
11299 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE8 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE8,
11300 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE9 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE9,
11301 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE10 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE10,
11302 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE11 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE11,
11303 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE12 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE12,
11304 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE13 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE13,
11305 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE14 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE14,
11306 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE15 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE15,
11307 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,' ','FAX_COUNTRY_CODE :'||l_invalid_size||'(10)') FAX_COUNTRY_CODE,
11308 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,' ','FAX_AREA_CODE :'||l_invalid_size||'(10)') FAX_AREA_CODE,
11309 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,' ','FAX_NUMBER :'||l_invalid_size||'(40)') FAX_NUMBER,
11310 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_ATTRIBUTE_CATEGORY,
11311 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ORG_CONTACT_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ORG_CONTACT_ATTRIBUTE_CATEGORY,
11312 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ADDRESS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ADDRESS_ATTRIBUTE_CATEGORY,
11313 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CONTROL_YEAR,' ','x'))),'0123456789.',' x'))),0),0,' ','CONTROL_YEAR :'||l_invalid_number) CONTROL_YEAR,
11314 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DEBARMENTS_COUNT,' ','x'))),'0123456789.',' x'))),0),0,' ','DEBARMENTS_COUNT :'||l_invalid_number) DEBARMENTS_COUNT,
11315 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,' ','HOUSEHOLD_SIZE :'||l_invalid_number) HOUSEHOLD_SIZE,
11316 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','PERSONAL_INCOME :'||l_invalid_number) PERSONAL_INCOME,
11317 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,' ','NOTES :'||l_invalid_size||'(2000)') NOTES,
11318 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,' ','VEHICLE_RESPONSE_CODE :'||l_invalid_size||'(30)') VEHICLE_RESPONSE_CODE,
11319 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,' ','SALES_AGENT_EMAIL_ADDRESS:'||l_invalid_size||'(2000)') SALES_AGENT_EMAIL_ADDRESS,
11320 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) -240,0,' ','ORIG_SYSTEM_REFERENCE :'||l_invalid_size
11321 ||'(240)') ORIG_SYSTEM_REFERENCE
11322 FROM AMS_HZ_B2B_MAPPING_V
11323 WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
11324 and load_status = 'ERROR'
11325 AND
11326 (
11327 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PARTY_NAME))),255) - 255,0,'OK','NO') = 'NO'
11328 or
11329 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FISCAL_YEAREND_MONTH)),'x')),30) - 30,0,'OK','NO') = 'NO'
11330 or
11331 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DUNS_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11332 or
11333 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(EMPLOYEES_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11334 or
11335 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(YEAR_ESTABLISHED,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11336 or
11337 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CURR_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11338 or
11339 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(NEXT_FY_POTENTIAL_REVENUE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11340 or
11341 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11342 or
11343 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LINE_OF_BUSINESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
11344 or
11345 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
11346 or
11347 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
11348 or
11349 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
11350 or
11351 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
11352 or
11353 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),50) - 50,0,'OK','NO') = 'NO'
11354 or
11355 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CEO_NAME)),'x')),240) - 240,0,'OK','NO') = 'NO'
11356 or
11357 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME)),'x')),50) - 50,0,'OK','NO') = 'NO'
11358 or
11359 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME)),'x')),40) - 40,0,'OK','NO') = 'NO'
11360 or
11361 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
11362 or
11363 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JOB_TITLE)),'x')),100) - 100,0,'OK','NO') = 'NO'
11364 or
11365 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
11366 or
11367 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
11368 or
11369 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11370 or
11371 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11372 or
11373 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11374 or
11375 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11376 or
11377 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11378 or
11379 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11380 or
11381 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TIME_ZONE)),'x')),50) - 50,0,'OK','NO') = 'NO'
11382 or
11383 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
11384 or
11385 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11386 or
11387 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
11388 or
11389 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
11390 or
11391 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,'OK','NO') = 'NO'
11392 or
11393 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT)),'x')),60) - 60,0,'OK','NO') = 'NO'
11394 or
11395 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECISION_MAKER_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
11396 or
11397 DECODE(GREATEST(lengthb(nvl(SIC_CODE,'x')),30) - 30,0,'OK','NO') = 'NO'
11398 or
11399 DECODE(GREATEST(lengthb(nvl(SIC_CODE_TYPE,'x')),30) - 30,0,'OK','NO') = 'NO'
11400 or
11401 DECODE(GREATEST(lengthb(nvl(ANALYSIS_FY,'x')),5) - 5,0,'OK','NO') = 'NO'
11402 or
11403 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,'OK','NO') = 'NO'
11404 or
11405 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GSA_INDICATOR_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
11406 or
11407 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MISSION_STATEMENT)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11408 or
11409 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_NAME_PHONETIC)),'x')),320) - 320,0,'OK','NO') = 'NO'
11410 or
11411 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CATEGORY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11412 or
11413 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(JGZZ_FISCAL_CODE)),'x')),20) - 20,0,'OK','NO') = 'NO'
11414 or
11415 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,'OK','NO') = 'NO'
11416 or
11417 /*
11418 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11419 or
11420 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,'OK','NO') = 'NO'
11421 or
11422 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11423 or
11424 */
11425 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),50) - 50,0,'OK','NO') = 'NO'
11426 or
11427 /*
11428 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,'OK','NO') = 'NO'
11429 or
11430 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,'OK','NO') = 'NO'
11431 or
11432 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11433 or
11434 */
11435 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_TYPE)),'x')),50) - 50,0,'OK','NO') = 'NO'
11436 or
11437 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RURAL_ROUTE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11438 or
11439 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11440 or
11441 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BRANCH_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
11442 or
11443 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEAD_OF_HOUSEHOLD_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
11444 or
11445 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PUBLIC_PRIVATE_OWNERSHIP_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
11446 or
11447 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_LINE)),'x')),240) - 240,0,'OK','NO') = 'NO'
11448 or
11449 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(BUSINESS_SCOPE)),'x')),20) - 20,0,'OK','NO') = 'NO'
11450 or
11451 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CHIEF_EXECUTIVE_TITLE)),'x')),240) - 240,0,'OK','NO') = 'NO'
11452 or
11453 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
11454 or
11455 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
11456 or
11457 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
11458 or
11459 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
11460 or
11461 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
11462 or
11463 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
11464 or
11465 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
11466 or
11467 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
11468 or
11469 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
11470 or
11471 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
11472 or
11473 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_NAME)),'x')),240) - 240,0,'OK','NO') = 'NO'
11474 or
11475 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PRINCIPAL_TITLE)),'x')),240) - 240,0,'OK','NO') = 'NO'
11476 or
11477 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,'OK','NO') = 'NO'
11478 or
11479 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),360) - 360,0,'OK','NO') = 'NO'
11480 or
11481 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,'OK','NO') = 'NO'
11482 or
11483 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONGRESSIONAL_DISTRICT_CODE)),'x')),2) - 2,0,'OK','NO') = 'NO'
11484 or
11485 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CORPORATION_CLASS)),'x')),60) - 60,0,'OK','NO') = 'NO'
11486 or
11487 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
11488 or
11489 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
11490 or
11491 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
11492 or
11493 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PLACE_OF_BIRTH)),'x')),60) - 60,0,'OK','NO') = 'NO'
11494 or
11495 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_ID)),'x')),60) - 60,0,'OK','NO') = 'NO'
11496 or
11497 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11498 or
11499 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(WOMAN_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11500 or
11501 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11502 or
11503 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,'OK','NO') = 'NO'
11504 or
11505 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,'OK','NO') = 'NO'
11506 or
11507 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SMALL_BUSINESS_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11508 or
11509 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11510 or
11511 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MINORITY_OWNED_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11512 or
11513 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11514 or
11515 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(OUT_OF_BUSINESS_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11516 or
11517 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11518 or
11519 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LABOR_SURPLUS_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11520 or
11521 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11522 or
11523 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCAL_ACTIVITY_CODE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11524 or
11525 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(IMPORT_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11526 or
11527 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DISADVANTAGED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11528 or
11529 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DEPARTMENT_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11530 or
11531 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CREDIT_SCORE_COMMENTARY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11532 or
11533 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EXPORT_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11534 or
11535 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11536 or
11537 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_COMMENTARY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11538 or
11539 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAILURE_SCORE_OVERRIDE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11540 or
11541 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DB_RATING)),'x')),5) - 5,0,'OK','NO') = 'NO'
11542 or
11543 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(GLOBAL_FAILURE_SCORE)),'x')),5) - 5,0,'OK','NO') = 'NO'
11544 or
11545 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ENQUIRY_DUNS)),'x')),15) - 15,0,'OK','NO') = 'NO'
11546 or
11547 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11548 or
11549 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11550 or
11551 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
11552 or
11553 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
11554 or
11555 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
11556 or
11557 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
11558 or
11559 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
11560 or
11561 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
11562 or
11563 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
11564 or
11565 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
11566 or
11567 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
11568 or
11569 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
11570 or
11571 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
11572 or
11573 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
11574 or
11575 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
11576 or
11577 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
11578 or
11579 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORGANIZATION_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
11580 or
11581 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
11582 or
11583 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
11584 or
11585 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
11586 or
11587 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
11588 or
11589 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
11590 or
11591 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
11592 or
11593 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
11594 or
11595 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
11596 or
11597 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
11598 or
11599 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
11600 or
11601 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
11602 or
11603 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
11604 or
11605 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
11606 or
11607 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
11608 or
11609 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
11610 or
11611 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
11612 or
11613 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
11614 or
11615 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
11616 or
11617 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
11618 or
11619 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
11620 or
11621 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
11622 or
11623 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
11624 or
11625 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
11626 or
11627 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
11628 or
11629 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
11630 or
11631 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
11632 or
11633 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
11634 or
11635 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
11636 or
11637 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
11638 or
11639 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
11640 or
11641 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11642 or
11643 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORG_CONTACT_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11644 or
11645 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11646 or
11647 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
11648 or
11649 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
11650 or
11651 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,'OK','NO') = 'NO'
11652 or
11653 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(CONTROL_YEAR,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11654 or
11655 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(DEBARMENTS_COUNT,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11656 or
11657 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11658 or
11659 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11660 or
11661 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11662 or
11663 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11664 or
11665 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11666 or
11667 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,'OK','NO') = 'NO'
11668 );
11669
11670
11671
11672
11673 -- Cursor for B2C party type
11674
11675 cursor b2c is
11676 SELECT
11677 IMPORT_SOURCE_LINE_ID,
11678 import_list_header_id,
11679 per_imp_xml_element_id,
11680 add_imp_xml_element_id,
11681 cp_imp_xml_element_id,
11682 em_imp_xml_element_id,
11683 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,' ','ADDRESS1 :'||l_invalid_size||'(240)') ADDRESS1,
11684 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,' ','ADDRESS2 :'||l_invalid_size||'(240)') ADDRESS2,
11685 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,' ','ADDRESS3 :'||l_invalid_size||'(240)') ADDRESS3,
11686 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,' ','ADDRESS4 :'||l_invalid_size||'(240)') ADDRESS4,
11687 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PERSON_LAST_NAME))),50) - 50,0,' ','PERSON_LAST_NAME :'||decode(nvl(PERSON_LAST_NAME,'x'),'x',l_null_value,l_invalid_size)||'(50)') PERSON_LAST_NAME,
11688 DECODE(GREATEST(lengthb(LTRIM(RTRIM(PERSON_FIRST_NAME))),40) - 40,0,' ','PERSON_FIRST_NAME :'||decode(nvl(PERSON_FIRST_NAME,'x'),'x',l_null_value,l_invalid_size)||'(40)') PERSON_FIRST_NAME,
11689 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,' ','PERSON_NAME_PREFIX :'||l_invalid_size||'(30)') PERSON_NAME_PREFIX,
11690 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,' ','PERSON_MIDDLE_NAME :'||l_invalid_size||'(60)') PERSON_MIDDLE_NAME,
11691 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,' ','PERSON_NAME_SUFFIX :'||l_invalid_size||'(30)') PERSON_NAME_SUFFIX,
11692 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,' ','CITY :'||l_invalid_size||'(60)') CITY ,
11693 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALUTATION)),'x')),60) - 60,0,' ','SALUTATION :'||l_invalid_size||'(60)') SALUTATION,
11694 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,' ','POSTAL_CODE :'||l_invalid_size||'(60)') POSTAL_CODE,
11695 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,' ','STATE :'||l_invalid_size||'(60)') STATE,
11696 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,' ','PROVINCE :'||l_invalid_size||'(60)') PROVINCE,
11697 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,' ','COUNTY :'||l_invalid_size||'(60)') COUNTY,
11698 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,' ','COUNTRY :'||l_invalid_size||'(60)') COUNTRY,
11699 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,' ','EMAIL_ADDRESS :'||l_invalid_size||'(240)') EMAIL_ADDRESS,
11700 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,' ','PHONE_COUNTRY_CODE :'||l_invalid_size||'(30)') PHONE_COUNTRY_CODE,
11701 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,' ','PHONE_AREA_CODE :'||l_invalid_size||'(10)') PHONE_AREA_CODE,
11702 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,' ','PHONE_NUMBER :'||l_invalid_size||'(25)') PHONE_NUMBER,
11703 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,' ','PHONE_EXTENTION :'||l_invalid_size||'(20)') PHONE_EXTENTION,
11704 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,' ','identifying_address_flag :'||l_invalid_size||'(1)') identifying_address_flag,
11705 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,' ','ADDRESS_LINES_PHONETIC :'||l_invalid_size||'(560)') ADDRESS_LINES_PHONETIC,
11706 -- bug 4641591: columns obsolete
11707 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,' ','PO_BOX_NUMBER :'||l_invalid_size||'(50)') PO_BOX_NUMBER,
11708 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,' ','FLOOR :'||l_invalid_size||'(50)') FLOOR,
11709 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,' ','HOUSE_NUMBER :'||l_invalid_size||'(50)') HOUSE_NUMBER,
11710 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),10) - 10,0,' ','POSTAL_PLUS4_CODE :'||l_invalid_size||'(10)') POSTAL_PLUS4_CODE,
11711 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,' ','STREET_SUFFIX :'||l_invalid_size||'(50)') STREET_SUFFIX,
11712 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,' ','STREET :'||l_invalid_size||'(50)') STREET,
11713 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,' ','STREET_NUMBER :'||l_invalid_size||'(50)') STREET_NUMBER,
11714 -- DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SUITE)),'x')),50) - 50,0,' ','SUITE :'||l_invalid_size||'(50)') SUITE,
11715 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,' ','PARTY_ID :'||l_invalid_number) party_id,
11716 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URL)),'x')),2000) - 2000,0,' ','URL :'||l_invalid_size||'(2000)') URL,
11717 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,' ','DECLARED_ETHNICITY :'||l_invalid_size||'(60)') DECLARED_ETHNICITY,
11718 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION:'||l_invalid_size||'(2000)') DESCRIPTION,
11719 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HEAD_OF_HOUSEHOLD_FLAG)),'x')),1) - 1,0,' ','HEAD_OF_HOUSEHOLD_FLAG :'||l_invalid_size||'(1)') HEAD_OF_HOUSEHOLD_FLAG,
11720 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS :'||l_invalid_size||'(240)') PERSON_KNOWN_AS,
11721 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS2 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS2,
11722 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS3 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS3,
11723 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS4 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS4,
11724 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,' ','PERSON_KNOWN_AS5 :'||l_invalid_size||'(240)') PERSON_KNOWN_AS5,
11725 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,' ','LOCATION_DIRECTIONS:'||l_invalid_size||'(640)') LOCATION_DIRECTIONS,
11726 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,' ','MARITAL_STATUS :'||l_invalid_size||'(30)') MARITAL_STATUS,
11727 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,' ','PERSON_ACADEMIC_TITLE :'||l_invalid_size||'(30)') PERSON_ACADEMIC_TITLE,
11728 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_FIRST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_FIRST_NAME_PHONETIC,
11729 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,' ','PERSON_LAST_NAME_PHONETIC :'||l_invalid_size||'(60)') PERSON_LAST_NAME_PHONETIC,
11730 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,' ','MIDDLE_NAME_PHONETIC :'||l_invalid_size||'(60)') MIDDLE_NAME_PHONETIC,
11731 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),320) - 320,0,' ','PERSON_NAME_PHONETIC :'||l_invalid_size||'(320)') PERSON_NAME_PHONETIC,
11732 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,' ','PERSON_PREVIOUS_TITLE_NAME :'||l_invalid_size||'(150)') PERSON_PREVIOUS_TITLE_NAME,
11733 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,
11734 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE1)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE1 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE1,
11735 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE2)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE2 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE2,
11736 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE3)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE3 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE3,
11737 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE4)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE4 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE4,
11738 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE5)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE5 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE5,
11739 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE6)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE6 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE6,
11740 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE7)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE7 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE7,
11741 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE8)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE8 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE8,
11742 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE9)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE9 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE9,
11743 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE10)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE10 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE10,
11744 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE11)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE11 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE11,
11745 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE12)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE12 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE12,
11746 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE13)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE13 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE13,
11747 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE14)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE14 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE14,
11748 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE15)),'x')),150) - 150,0,' ','PERSON_ATTRIBUTE15 :'||l_invalid_size||'(150)') PERSON_ATTRIBUTE15,
11749 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE1 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE1,
11750 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE2 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE2,
11751 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE3 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE3,
11752 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE4 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE4,
11753 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE5 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE5,
11754 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE6 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE6,
11755 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE7 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE7,
11756 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE8 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE8,
11757 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE9 : '||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE9,
11758 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE10 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE10,
11759 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE11 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE11,
11760 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE12 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE12,
11761 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE13 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE13,
11762 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE14 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE14,
11763 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,' ','ADDRESS_ATTRIBUTE15 :'||l_invalid_size||'(150)') ADDRESS_ATTRIBUTE15,
11764 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,' ','FAX_COUNTRY_CODE :'||l_invalid_size||'(10)') FAX_COUNTRY_CODE,
11765 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,' ','FAX_AREA_CODE :'||l_invalid_size||'(10)') FAX_AREA_CODE,
11766 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,' ','FAX_NUMBER :'||l_invalid_size||'(40)') FAX_NUMBER,
11767 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','ADDRESS_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') ADDRESS_ATTRIBUTE_CATEGORY,
11768 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,' ','PERSON_ATTRIBUTE_CATEGORY :'||l_invalid_size||'(30)') PERSON_ATTRIBUTE_CATEGORY,
11769 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,' ','HOUSEHOLD_SIZE :'||l_invalid_number) HOUSEHOLD_SIZE,
11770 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','PERSONAL_INCOME :'||l_invalid_number) PERSONAL_INCOME,
11771 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,' ','DESCRIPTION:'||l_invalid_size||'(2000)') DESCRIPTION,
11772 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,' ','SHORT_DESCRIPTION :'||l_invalid_size||'(240)') SHORT_DESCRIPTION,
11773 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,' ','NOTES :'||l_invalid_size||'(2000)') NOTES,
11774 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,' ','VEHICLE_RESPONSE_CODE :'||l_invalid_size||'(30)') VEHICLE_RESPONSE_CODE,
11775 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,' ','SALES_AGENT_EMAIL_ADDRESS:'||l_invalid_size||'(2000)') SALES_AGENT_EMAIL_ADDRESS,
11776 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) -240,0,' ','ORIG_SYSTEM_REFERENCE :'||l_invalid_size
11777 ||'(240)') ORIG_SYSTEM_REFERENCE,
11778 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),60) - 60,0,' ','TAX_REFERENCE :'||l_invalid_size||'(60)') TAX_REFERENCE,
11779 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,' ','RENT_OWNED_INDICATOR :'||l_invalid_size||'(30)') RENT_OWNED_INDICATOR
11780 FROM AMS_HZ_B2C_MAPPING_V
11781 WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
11782 and load_status = 'ERROR'
11783 AND
11784 (
11785 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(party_id,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11786 or
11787 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
11788 or
11789 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
11790 or
11791 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
11792 or
11793 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
11794 or
11795 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME)),'x')),50) - 50,0,'OK','NO') = 'NO'
11796 or
11797 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME)),'x')),40) - 40,0,'OK','NO') = 'NO'
11798 or
11799 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PREFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
11800 or
11801 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_MIDDLE_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
11802 or
11803 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
11804 or
11805 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11806 or
11807 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11808 or
11809 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11810 or
11811 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SALUTATION)),'x')),60) - 60,0,'OK','NO') = 'NO'
11812 or
11813 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11814 or
11815 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11816 or
11817 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11818 or
11819 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
11820 or
11821 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_COUNTRY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11822 or
11823 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
11824 or
11825 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
11826 or
11827 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PHONE_EXTENTION)),'x')),20) - 20,0,'OK','NO') = 'NO'
11828 or
11829 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(identifying_address_flag)),'x')),1) - 1,0,'OK','NO') = 'NO'
11830 or
11831 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_LINES_PHONETIC)),'x')),560) - 560,0,'OK','NO') = 'NO'
11832 or
11833 /*
11834 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PO_BOX_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11835 or
11836 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FLOOR)),'x')),50) - 50,0,'OK','NO') = 'NO'
11837 or
11838 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(HOUSE_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11839 or
11840 */
11841 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(POSTAL_PLUS4_CODE)),'x')),50) - 50,0,'OK','NO') = 'NO'
11842 or
11843 /*
11844 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_SUFFIX)),'x')),50) - 50,0,'OK','NO') = 'NO'
11845 or
11846 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET)),'x')),50) - 50,0,'OK','NO') = 'NO'
11847 or
11848 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(STREET_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
11849 or
11850 */
11851 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11852 or
11853 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS)),'x')),240) - 240,0,'OK','NO') = 'NO'
11854 or
11855 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
11856 or
11857 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
11858 or
11859 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
11860 or
11861 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_KNOWN_AS5)),'x')),240) - 240,0,'OK','NO') = 'NO'
11862 or
11863 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(SHORT_DESCRIPTION)),'x')),240) - 240,0,'OK','NO') = 'NO'
11864 or
11865 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_NAME_PHONETIC)),'x')),360) - 360,0,'OK','NO') = 'NO'
11866 or
11867 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(LOCATION_DIRECTIONS)),'x')),640) - 640,0,'OK','NO') = 'NO'
11868 or
11869 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_FIRST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
11870 or
11871 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_LAST_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
11872 or
11873 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MIDDLE_NAME_PHONETIC)),'x')),60) - 60,0,'OK','NO') = 'NO'
11874 or
11875 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PLACE_OF_BIRTH)),'x')),60) - 60,0,'OK','NO') = 'NO'
11876 or
11877 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_PREVIOUS_TITLE_NAME)),'x')),150) - 150,0,'OK','NO') = 'NO'
11878 or
11879 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(MARITAL_STATUS)),'x')),30) - 30,0,'OK','NO') = 'NO'
11880 or
11881 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ACADEMIC_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11882 or
11883 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DECLARED_ETHNICITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
11884 or
11885 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(DESCRIPTION)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11886 or
11887 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
11888 or
11889 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
11890 or
11891 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
11892 or
11893 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
11894 or
11895 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
11896 or
11897 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
11898 or
11899 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
11900 or
11901 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
11902 or
11903 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
11904 or
11905 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
11906 or
11907 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
11908 or
11909 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
11910 or
11911 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
11912 or
11913 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
11914 or
11915 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
11916 or
11917 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE1)),'x')),150) - 150,0,'OK','NO') = 'NO'
11918 or
11919 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE2)),'x')),150) - 150,0,'OK','NO') = 'NO'
11920 or
11921 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE3)),'x')),150) - 150,0,'OK','NO') = 'NO'
11922 or
11923 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE4)),'x')),150) - 150,0,'OK','NO') = 'NO'
11924 or
11925 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE5)),'x')),150) - 150,0,'OK','NO') = 'NO'
11926 or
11927 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE6)),'x')),150) - 150,0,'OK','NO') = 'NO'
11928 or
11929 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE7)),'x')),150) - 150,0,'OK','NO') = 'NO'
11930 or
11931 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE8)),'x')),150) - 150,0,'OK','NO') = 'NO'
11932 or
11933 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE9)),'x')),150) - 150,0,'OK','NO') = 'NO'
11934 or
11935 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE10)),'x')),150) - 150,0,'OK','NO') = 'NO'
11936 or
11937 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE11)),'x')),150) - 150,0,'OK','NO') = 'NO'
11938 or
11939 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE12)),'x')),150) - 150,0,'OK','NO') = 'NO'
11940 or
11941 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE13)),'x')),150) - 150,0,'OK','NO') = 'NO'
11942 or
11943 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE14)),'x')),150) - 150,0,'OK','NO') = 'NO'
11944 or
11945 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE15)),'x')),150) - 150,0,'OK','NO') = 'NO'
11946 or
11947 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(PERSON_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11948 or
11949 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ADDRESS_ATTRIBUTE_CATEGORY)),'x')),30) - 30,0,'OK','NO') = 'NO'
11950 or
11951 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_COUNTRY_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
11952 or
11953 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
11954 or
11955 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(FAX_NUMBER)),'x')),40) - 40,0,'OK','NO') = 'NO'
11956 or
11957 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(HOUSEHOLD_SIZE,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11958 or
11959 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(PERSONAL_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
11960 or
11961 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(NOTES)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11962 or
11963 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(VEHICLE_RESPONSE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
11964 or
11965 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(SALES_AGENT_EMAIL_ADDRESS)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
11966 or
11967 DECODE(GREATEST(LENGTH(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) - 240,0,'OK','NO') = 'NO'
11968 or
11969 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
11970 or
11971 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,'OK','NO') = 'NO'
11972 );
11973
11974
11975 -- Cursor to check if it's B2B or B2C party type.
11976
11977 cursor b2borb2c is
11978 select import_type from ams_imp_list_headers_all
11979 where import_list_header_id = p_import_list_header_id;
11980
11981
11982 begin
11983
11984 IF p_import_list_header_id IS NULL THEN
11985 RAISE FND_API.G_EXC_ERROR;
11986 END IF;
11987 p_return_status := FND_API.G_RET_STS_SUCCESS;
11988
11989 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_DATATYPE_ERROR_CHK');
11990 l_invalid_number := FND_MESSAGE.get;
11991 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_SIZE_ERROR_CHK');
11992 l_invalid_size := FND_MESSAGE.get;
11993 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_NULL_ERROR_CHK');
11994 l_null_value := FND_MESSAGE.get;
11995
11996 OPEN b2borb2c;
11997 FETCH b2borb2c into x_b2b;
11998 close b2borb2c;
11999 OPEN c_lead_batch_id;
12000 FETCH c_lead_batch_id into l_batch_id;
12001 CLOSE c_lead_batch_id;
12002
12003 if x_b2b = 'B2B' then
12004 OPEN b2b;
12005 LOOP
12006 FETCH b2b INTO
12007 l_import_source_line_id,
12008 l_import_list_header_id,
12009 l_cust_b2b_rec.org_imp_xml_element_id,
12010 l_cust_b2b_rec.add_imp_xml_element_id,
12011 l_cust_b2b_rec.ocont_imp_xml_element_id,
12012 l_cust_b2b_rec.cp_imp_xml_element_id,
12013 l_cust_b2b_rec.em_imp_xml_element_id,
12014 l_cust_b2b_rec.PARTY_NAME,
12015 l_cust_b2b_rec.FISCAL_YEAREND_MONTH,
12016 l_cust_b2b_rec.DUNS_NUMBER,
12017 l_cust_b2b_rec.EMPLOYEES_TOTAL,
12018 l_cust_b2b_rec.LINE_OF_BUSINESS,
12019 l_cust_b2b_rec.ADDRESS1,
12020 l_cust_b2b_rec.ADDRESS2,
12021 l_cust_b2b_rec.ADDRESS3,
12022 l_cust_b2b_rec.ADDRESS4,
12023 l_cust_b2b_rec.YEAR_ESTABLISHED,
12024 l_cust_b2b_rec.TAX_REFERENCE,
12025 l_cust_b2b_rec.CEO_NAME,
12026 l_cust_b2b_rec.PERSON_LAST_NAME,
12027 l_cust_b2b_rec.PERSON_FIRST_NAME,
12028 l_cust_b2b_rec.PERSON_NAME_PREFIX,
12029 l_cust_b2b_rec.JOB_TITLE,
12030 l_cust_b2b_rec.PERSON_MIDDLE_NAME,
12031 l_cust_b2b_rec.PERSON_NAME_SUFFIX,
12032 l_cust_b2b_rec.CITY,
12033 l_cust_b2b_rec.POSTAL_CODE,
12034 l_cust_b2b_rec.STATE,
12035 l_cust_b2b_rec.PROVINCE,
12036 l_cust_b2b_rec.COUNTY,
12037 l_cust_b2b_rec.COUNTRY,
12038 l_cust_b2b_rec.EMAIL_ADDRESS,
12039 l_cust_b2b_rec.PHONE_COUNTRY_CODE,
12040 l_cust_b2b_rec.PHONE_AREA_CODE,
12041 l_cust_b2b_rec.PHONE_NUMBER,
12042 l_cust_b2b_rec.PHONE_EXTENSION,
12043 l_cust_b2b_rec.DEPARTMENT,
12044 l_cust_b2b_rec.DECISION_MAKER_FLAG,
12045 l_cust_b2b_rec.SIC_CODE,
12046 l_cust_b2b_rec.SIC_CODE_TYPE,
12047 l_cust_b2b_rec.ANALYSIS_FY,
12048 l_cust_b2b_rec.CURR_FY_POTENTIAL_REVENUE,
12049 l_cust_b2b_rec.NEXT_FY_POTENTIAL_REVENUE,
12050 l_cust_b2b_rec.GSA_INDICATOR_FLAG,
12051 l_cust_b2b_rec.identifying_address_flag,
12052 l_cust_b2b_rec.MISSION_STATEMENT,
12053 l_cust_b2b_rec.ORGANIZATION_NAME_PHONETIC,
12054 l_cust_b2b_rec.CATEGORY_CODE,
12055 l_cust_b2b_rec.JGZZ_FISCAL_CODE,
12056 l_cust_b2b_rec.ADDRESS_LINES_PHONETIC,
12057 -- bug 4641591: columns obsolete
12058 -- l_cust_b2b_rec.PO_BOX_NUMBER,
12059 -- l_cust_b2b_rec.FLOOR,
12060 -- l_cust_b2b_rec.HOUSE_NUMBER,
12061 l_cust_b2b_rec.POSTAL_PLUS4_CODE,
12062 -- l_cust_b2b_rec.STREET_SUFFIX,
12063 -- l_cust_b2b_rec.STREET,
12064 -- l_cust_b2b_rec.STREET_NUMBER,
12065 -- l_cust_b2b_rec.SUITE,
12066 l_cust_b2b_rec.party_id,
12067 l_cust_b2b_rec.ORGANIZATION_URL,
12068 l_cust_b2b_rec.BRANCH_FLAG,
12069 l_cust_b2b_rec.BUSINESS_LINE,
12070 l_cust_b2b_rec.BUSINESS_SCOPE,
12071 l_cust_b2b_rec.CHIEF_EXECUTIVE_TITLE,
12072 l_cust_b2b_rec.CONGRESSIONAL_DISTRICT_CODE,
12073 l_cust_b2b_rec.CORPORATION_CLASS,
12074 l_cust_b2b_rec.CREDIT_SCORE,
12075 l_cust_b2b_rec.CREDIT_SCORE_COMMENTARY,
12076 l_cust_b2b_rec.DB_RATING,
12077 l_cust_b2b_rec.DECLARED_ETHNICITY,
12078 l_cust_b2b_rec.DEPARTMENT_INDICATOR,
12079 l_cust_b2b_rec.DESCRIPTION,
12080 l_cust_b2b_rec.DISADVANTAGED_INDICATOR,
12081 l_cust_b2b_rec.ENQUIRY_DUNS,
12082 l_cust_b2b_rec.EXPORT_INDICATOR,
12083 l_cust_b2b_rec.FAILURE_SCORE,
12084 l_cust_b2b_rec.FAILURE_SCORE_COMMENTARY,
12085 l_cust_b2b_rec.FAILURE_SCORE_OVERRIDE_CODE,
12086 l_cust_b2b_rec.GLOBAL_FAILURE_SCORE,
12087 l_cust_b2b_rec.HEADQUARTER_BRANCH_INDICATOR,
12088 l_cust_b2b_rec.HEAD_OF_HOUSEHOLD_FLAG,
12089 l_cust_b2b_rec.IMPORT_INDICATOR,
12090 l_cust_b2b_rec.ORGANIZATION_KNOWN_AS,
12091 l_cust_b2b_rec.ORGANIZATION_KNOWN_AS2,
12092 l_cust_b2b_rec.ORGANIZATION_KNOWN_AS3,
12093 l_cust_b2b_rec.ORGANIZATION_KNOWN_AS4,
12094 l_cust_b2b_rec.ORGANIZATION_KNOWN_AS5,
12095 l_cust_b2b_rec.PERSON_KNOWN_AS,
12096 l_cust_b2b_rec.PERSON_KNOWN_AS2,
12097 l_cust_b2b_rec.PERSON_KNOWN_AS3,
12098 l_cust_b2b_rec.PERSON_KNOWN_AS4,
12099 l_cust_b2b_rec.PERSON_KNOWN_AS5,
12100 l_cust_b2b_rec.LABOR_SURPLUS_INDICATOR,
12101 l_cust_b2b_rec.LOCAL_ACTIVITY_CODE,
12102 l_cust_b2b_rec.LOCAL_ACTIVITY_CODE_TYPE,
12103 l_cust_b2b_rec.LOCATION_DIRECTIONS,
12104 l_cust_b2b_rec.MARITAL_STATUS,
12105 l_cust_b2b_rec.MINORITY_OWNED_INDICATOR,
12106 l_cust_b2b_rec.MINORITY_OWNED_TYPE,
12107 l_cust_b2b_rec.ORGANIZATION_TYPE,
12108 l_cust_b2b_rec.OUT_OF_BUSINESS_INDICATOR,
12109 l_cust_b2b_rec.PERSON_ACADEMIC_TITLE,
12110 l_cust_b2b_rec.PERSON_FIRST_NAME_PHONETIC,
12111 l_cust_b2b_rec.PERSON_LAST_NAME_PHONETIC,
12112 l_cust_b2b_rec.MIDDLE_NAME_PHONETIC,
12113 l_cust_b2b_rec.PERSON_NAME_PHONETIC,
12114 l_cust_b2b_rec.PERSON_PREVIOUS_TITLE_NAME,
12115 l_cust_b2b_rec.PLACE_OF_BIRTH,
12116 l_cust_b2b_rec.PRINCIPAL_NAME,
12117 l_cust_b2b_rec.PRINCIPAL_TITLE,
12118 l_cust_b2b_rec.PUBLIC_PRIVATE_OWNERSHIP_FLAG,
12119 l_cust_b2b_rec.RENT_OWNED_INDICATOR,
12120 -- l_cust_b2b_rec.SECOND_TITLE,
12121 l_cust_b2b_rec.SHORT_DESCRIPTION,
12122 l_cust_b2b_rec.SMALL_BUSINESS_INDICATOR,
12123 l_cust_b2b_rec.TAX_ID,
12124 l_cust_b2b_rec.WOMAN_OWNED_INDICATOR,
12125 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE1,
12126 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE2,
12127 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE3,
12128 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE4,
12129 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE5,
12130 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE6,
12131 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE7,
12132 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE8,
12133 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE9,
12134 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE10,
12135 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE11,
12136 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE12,
12137 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE13,
12138 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE14,
12139 l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE15,
12140 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE1,
12141 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE2,
12142 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE3,
12143 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE4,
12144 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE5,
12145 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE6,
12146 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE7,
12147 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE8,
12148 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE9,
12149 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE10,
12150 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE11,
12151 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE12,
12152 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE13,
12153 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE14,
12154 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE15,
12155 l_cust_b2b_rec.ADDRESS_ATTRIBUTE1,
12156 l_cust_b2b_rec.ADDRESS_ATTRIBUTE2,
12157 l_cust_b2b_rec.ADDRESS_ATTRIBUTE3,
12158 l_cust_b2b_rec.ADDRESS_ATTRIBUTE4,
12159 l_cust_b2b_rec.ADDRESS_ATTRIBUTE5,
12160 l_cust_b2b_rec.ADDRESS_ATTRIBUTE6,
12161 l_cust_b2b_rec.ADDRESS_ATTRIBUTE7,
12162 l_cust_b2b_rec.ADDRESS_ATTRIBUTE8,
12163 l_cust_b2b_rec.ADDRESS_ATTRIBUTE9,
12164 l_cust_b2b_rec.ADDRESS_ATTRIBUTE10,
12165 l_cust_b2b_rec.ADDRESS_ATTRIBUTE11,
12166 l_cust_b2b_rec.ADDRESS_ATTRIBUTE12,
12167 l_cust_b2b_rec.ADDRESS_ATTRIBUTE13,
12168 l_cust_b2b_rec.ADDRESS_ATTRIBUTE14,
12169 l_cust_b2b_rec.ADDRESS_ATTRIBUTE15,
12170 l_cust_b2b_rec.FAX_COUNTRY_CODE,
12171 l_cust_b2b_rec.FAX_AREA_CODE,
12172 l_cust_b2b_rec.FAX_NUMBER,
12173 l_cust_b2b_rec.ORG_ATTRIBUTE_CATEGORY,
12174 -- l_cust_b2b_rec.PERSON_ATTRIBUTE_CATEGORY,
12175 l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE_CATEGORY,
12176 l_cust_b2b_rec.ADDRESS_ATTRIBUTE_CATEGORY,
12177 l_cust_b2b_rec.CONTROL_YEAR,
12178 l_cust_b2b_rec.DEBARMENTS_COUNT,
12179 l_cust_b2b_rec.HOUSEHOLD_SIZE,
12180 l_cust_b2b_rec.PERSONAL_INCOME,
12181 l_cust_b2b_rec.NOTES,
12182 l_cust_b2b_rec.VEHICLE_RESPONSE_CODE,
12183 l_cust_b2b_rec.SALES_AGENT_EMAIL_ID,
12184 l_cust_b2b_rec.orig_system_reference;
12185
12186
12187 EXIT WHEN b2b%NOTFOUND;
12188
12189 if trim(l_cust_b2b_rec.PARTY_NAME) is not null then
12190 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12191 'PARTY_NAME', l_cust_b2b_rec.PARTY_NAME);
12192 end if;
12193
12194 if trim(l_cust_b2b_rec.FISCAL_YEAREND_MONTH) is not null then
12195 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12196 'FISCAL_YEAREND_MONTH', l_cust_b2b_rec.FISCAL_YEAREND_MONTH);
12197 end if;
12198 if trim(l_cust_b2b_rec.DUNS_NUMBER) is not null then
12199 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12200 'DUNS_NUMBER', l_cust_b2b_rec.DUNS_NUMBER);
12201 end if;
12202 if trim(l_cust_b2b_rec.EMPLOYEES_TOTAL) is not null then
12203 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12204 'EMPLOYEES_TOTAL', l_cust_b2b_rec.EMPLOYEES_TOTAL);
12205 end if;
12206 if trim(l_cust_b2b_rec.LINE_OF_BUSINESS) is not null then
12207 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12208 'LINE_OF_BUSINESS', l_cust_b2b_rec.LINE_OF_BUSINESS);
12209 end if;
12210 if trim(l_cust_b2b_rec.ORIG_SYSTEM_REFERENCE) is not null then
12211 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12212 'ORIG_SYSTEM_REFERENCE', l_cust_b2b_rec.ORIG_SYSTEM_REFERENCE);
12213 end if;
12214 if trim(l_cust_b2b_rec.ADDRESS1) is not null then
12215 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12216 'ADDRESS1', l_cust_b2b_rec.ADDRESS1);
12217 end if;
12218 if trim(l_cust_b2b_rec.ADDRESS2) is not null then
12219 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12220 'ADDRESS2', l_cust_b2b_rec.ADDRESS2);
12221 end if;
12222 if trim(l_cust_b2b_rec.ADDRESS3) is not null then
12223 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12224 'ADDRESS3', l_cust_b2b_rec.ADDRESS3);
12225 end if;
12226 if trim(l_cust_b2b_rec.ADDRESS4) is not null then
12227 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12228 'ADDRESS4', l_cust_b2b_rec.ADDRESS4);
12229 end if;
12230 if trim(l_cust_b2b_rec.YEAR_ESTABLISHED) is not null then
12231 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12232 'YEAR_ESTABLISHED', l_cust_b2b_rec.YEAR_ESTABLISHED);
12233 end if;
12234 if trim(l_cust_b2b_rec.TAX_REFERENCE) is not null then
12235 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12236 'TAX_REFERENCE', l_cust_b2b_rec.TAX_REFERENCE);
12237 end if;
12238 if trim(l_cust_b2b_rec.CEO_NAME) is not null then
12239 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12240 'CEO_NAME', l_cust_b2b_rec.CEO_NAME);
12241 end if;
12242
12243 if trim(l_cust_b2b_rec.PERSON_LAST_NAME) is not null then
12244 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12245 'PERSON_LAST_NAME', l_cust_b2b_rec.PERSON_LAST_NAME);
12246 end if;
12247 if trim(l_cust_b2b_rec.PERSON_FIRST_NAME) is not null then
12248 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12249 'PERSON_FIRST_NAME', l_cust_b2b_rec.PERSON_FIRST_NAME);
12250 end if;
12251 if trim(l_cust_b2b_rec.PERSON_NAME_PREFIX) is not null then
12252 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12253 'PERSON_NAME_PREFIX', l_cust_b2b_rec.PERSON_NAME_PREFIX);
12254 end if;
12255 if trim(l_cust_b2b_rec.JOB_TITLE) is not null then
12256 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12257 'JOB_TITLE', l_cust_b2b_rec.JOB_TITLE);
12258 end if;
12259 if trim(l_cust_b2b_rec.PERSON_MIDDLE_NAME) is not null then
12260 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12261 'PERSON_MIDDLE_NAME', l_cust_b2b_rec.PERSON_MIDDLE_NAME);
12262 end if;
12263 if trim(l_cust_b2b_rec.PERSON_NAME_SUFFIX) is not null then
12264 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12265 'PERSON_NAME_SUFFIX', l_cust_b2b_rec.PERSON_NAME_SUFFIX);
12266 end if;
12267 if trim(l_cust_b2b_rec.CITY) is not null then
12268 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12269 'CITY', l_cust_b2b_rec.CITY);
12270 end if;
12271 if trim(l_cust_b2b_rec.POSTAL_CODE) is not null then
12272 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12273 'POSTAL_CODE', l_cust_b2b_rec.POSTAL_CODE);
12274 end if;
12275 if trim(l_cust_b2b_rec.STATE) is not null then
12276 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12277 'STATE', l_cust_b2b_rec.STATE);
12278 end if;
12279 if trim(l_cust_b2b_rec.PROVINCE) is not null then
12280 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12281 'PROVINCE', l_cust_b2b_rec.PROVINCE);
12282 end if;
12283 if trim(l_cust_b2b_rec.COUNTY) is not null then
12284 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12285 'COUNTY', l_cust_b2b_rec.COUNTY);
12286 end if;
12287
12288 if trim(l_cust_b2b_rec.COUNTRY) is not null then
12289 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12290 'COUNTRY', l_cust_b2b_rec.COUNTRY);
12291 end if;
12292 if trim(l_cust_b2b_rec.EMAIL_ADDRESS) is not null then
12293 update_element_error (p_import_list_header_id,l_cust_b2b_rec.em_imp_xml_element_id,
12294 'EMAIL_ADDRESS', l_cust_b2b_rec.EMAIL_ADDRESS);
12295 end if;
12296 if trim(l_cust_b2b_rec.PHONE_COUNTRY_CODE) is not null then
12297 update_element_error (p_import_list_header_id,l_cust_b2b_rec.cp_imp_xml_element_id,
12298 'PHONE_COUNTRY_CODE', l_cust_b2b_rec.PHONE_COUNTRY_CODE);
12299 end if;
12300 if trim(l_cust_b2b_rec.PHONE_AREA_CODE) is not null then
12301 update_element_error (p_import_list_header_id,l_cust_b2b_rec.cp_imp_xml_element_id,
12302 'PHONE_AREA_CODE', l_cust_b2b_rec.PHONE_AREA_CODE);
12303 end if;
12304 if trim(l_cust_b2b_rec.PHONE_NUMBER) is not null then
12305 update_element_error (p_import_list_header_id,l_cust_b2b_rec.cp_imp_xml_element_id,
12306 'PHONE_NUMBER', l_cust_b2b_rec.PHONE_NUMBER);
12307 end if;
12308 if trim(l_cust_b2b_rec.PHONE_EXTENSION) is not null then
12309 update_element_error (p_import_list_header_id,l_cust_b2b_rec.cp_imp_xml_element_id,
12310 'PHONE_EXTENSION', l_cust_b2b_rec.PHONE_EXTENSION);
12311 end if;
12312 if trim(l_cust_b2b_rec.DEPARTMENT) is not null then
12313 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12314 'DEPARTMENT', l_cust_b2b_rec.DEPARTMENT);
12315 end if;
12316 if trim(l_cust_b2b_rec.DECISION_MAKER_FLAG) is not null then
12317 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12318 'DECISION_MAKER_FLAG', l_cust_b2b_rec.DECISION_MAKER_FLAG);
12319 end if;
12320 if trim(l_cust_b2b_rec.SIC_CODE) is not null then
12321 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12322 'SIC_CODE', l_cust_b2b_rec.SIC_CODE);
12323 end if;
12324 if trim(l_cust_b2b_rec.SIC_CODE_TYPE) is not null then
12325 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12326 'SIC_CODE_TYPE', l_cust_b2b_rec.SIC_CODE_TYPE);
12327 end if;
12328 if trim(l_cust_b2b_rec.ANALYSIS_FY) is not null then
12329 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12330 'ANALYSIS_FY', l_cust_b2b_rec.ANALYSIS_FY);
12331 end if;
12332
12333 if trim(l_cust_b2b_rec.CURR_FY_POTENTIAL_REVENUE) is not null then
12334 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12335 'CURR_FY_POTENTIAL_REVENUE', l_cust_b2b_rec.CURR_FY_POTENTIAL_REVENUE);
12336 end if;
12337 if trim(l_cust_b2b_rec.NEXT_FY_POTENTIAL_REVENUE) is not null then
12338 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12339 'NEXT_FY_POTENTIAL_REVENUE', l_cust_b2b_rec.NEXT_FY_POTENTIAL_REVENUE);
12340 end if;
12341 if trim(l_cust_b2b_rec.GSA_INDICATOR_FLAG) is not null then
12342 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12343 'GSA_INDICATOR_FLAG', l_cust_b2b_rec.GSA_INDICATOR_FLAG);
12344 end if;
12345 if trim(l_cust_b2b_rec.identifying_address_flag) is not null then
12346 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12347 'IDENTIFYING_ADDRESS_FLAG', l_cust_b2b_rec.IDENTIFYING_ADDRESS_FLAG);
12348 end if;
12349 if trim(l_cust_b2b_rec.MISSION_STATEMENT) is not null then
12350 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12351 'MISSION_STATEMENT', l_cust_b2b_rec.MISSION_STATEMENT);
12352 end if;
12353 if trim(l_cust_b2b_rec.ORGANIZATION_NAME_PHONETIC) is not null then
12354 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12355 'ORGANIZATION_NAME_PHONETIC', l_cust_b2b_rec.ORGANIZATION_NAME_PHONETIC);
12356 end if;
12357 if trim(l_cust_b2b_rec.CATEGORY_CODE) is not null then
12358 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12359 'CATEGORY_CODE', l_cust_b2b_rec.CATEGORY_CODE);
12360 end if;
12361 if trim(l_cust_b2b_rec.JGZZ_FISCAL_CODE) is not null then
12362 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12363 'JGZZ_FISCAL_CODE', l_cust_b2b_rec.JGZZ_FISCAL_CODE);
12364 end if;
12365 if trim(l_cust_b2b_rec.ADDRESS_LINES_PHONETIC) is not null then
12366 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12367 'ADDRESS_LINES_PHONETIC', l_cust_b2b_rec.ADDRESS_LINES_PHONETIC);
12368 end if;
12369 /* -- bug 4641591: columns obsolete
12370 if trim(l_cust_b2b_rec.PO_BOX_NUMBER) is not null then
12371 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12372 'PO_BOX_NUMBER', l_cust_b2b_rec.PO_BOX_NUMBER);
12373 end if;
12374 if trim(l_cust_b2b_rec.FLOOR) is not null then
12375 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12376 'FLOOR', l_cust_b2b_rec.FLOOR);
12377 end if;
12378
12379 if trim(l_cust_b2b_rec.HOUSE_NUMBER) is not null then
12380 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12381 'HOUSE_NUMBER', l_cust_b2b_rec.HOUSE_NUMBER);
12382 end if;
12383 */
12384 if trim(l_cust_b2b_rec.POSTAL_PLUS4_CODE) is not null then
12385 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12386 'POSTAL_PLUS4_CODE', l_cust_b2b_rec.POSTAL_PLUS4_CODE);
12387 end if;
12388 /* -- bug 4641591: columns obsolete
12389 if trim(l_cust_b2b_rec.STREET_SUFFIX) is not null then
12390 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12391 'STREET_SUFFIX', l_cust_b2b_rec.STREET_SUFFIX);
12392 end if;
12393 if trim(l_cust_b2b_rec.STREET) is not null then
12394 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12395 'STREET', l_cust_b2b_rec.STREET);
12396 end if;
12397 if trim(l_cust_b2b_rec.STREET_NUMBER) is not null then
12398 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12399 'STREET_NUMBER', l_cust_b2b_rec.STREET_NUMBER);
12400 end if;
12401 if trim(l_cust_b2b_rec.SUITE) is not null then
12402 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12403 'SUITE', l_cust_b2b_rec.SUITE);
12404 end if;
12405 */
12406 if trim(l_cust_b2b_rec.party_id) is not null then
12407 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12408 'PARTY_ID', l_cust_b2b_rec.PARTY_ID);
12409 end if;
12410
12411 -- **********************************
12412 if trim(l_cust_b2b_rec.ORGANIZATION_URL) is not null then
12413 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12414 'ORGANIZATION_URL', l_cust_b2b_rec.ORGANIZATION_URL);
12415 end if;
12416 if trim(l_cust_b2b_rec.BRANCH_FLAG) is not null then
12417 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12418 'BRANCH_FLAG', l_cust_b2b_rec.BRANCH_FLAG);
12419 end if;
12420 if trim(l_cust_b2b_rec.BUSINESS_LINE) is not null then
12421 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12422 'BUSINESS_LINE', l_cust_b2b_rec.BUSINESS_LINE);
12423 end if;
12424 if trim(l_cust_b2b_rec.BUSINESS_SCOPE) is not null then
12425 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12426 'BUSINESS_SCOPE', l_cust_b2b_rec.BUSINESS_SCOPE);
12427 end if;
12428 if trim(l_cust_b2b_rec.CHIEF_EXECUTIVE_TITLE) is not null then
12429 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12430 'CHIEF_EXECUTIVE_TITLE', l_cust_b2b_rec.CHIEF_EXECUTIVE_TITLE);
12431 end if;
12432 if trim(l_cust_b2b_rec.CONGRESSIONAL_DISTRICT_CODE) is not null then
12433 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12434 'CONGRESSIONAL_DISTRICT_CODE', l_cust_b2b_rec.CONGRESSIONAL_DISTRICT_CODE);
12435 end if;
12436 if trim(l_cust_b2b_rec.CORPORATION_CLASS) is not null then
12437 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12438 'CORPORATION_CLASS', l_cust_b2b_rec.CORPORATION_CLASS);
12439 end if;
12440 if trim(l_cust_b2b_rec.CREDIT_SCORE) is not null then
12441 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12442 'CREDIT_SCORE', l_cust_b2b_rec.CREDIT_SCORE);
12443 end if;
12444 if trim(l_cust_b2b_rec.CREDIT_SCORE_COMMENTARY) is not null then
12445 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12446 'CREDIT_SCORE_COMMENTARY', l_cust_b2b_rec.CREDIT_SCORE_COMMENTARY);
12447 end if;
12448 if trim(l_cust_b2b_rec.DB_RATING) is not null then
12449 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12450 'DB_RATING', l_cust_b2b_rec.DB_RATING);
12451 end if;
12452 if trim(l_cust_b2b_rec.DECLARED_ETHNICITY) is not null then
12453 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12454 'DECLARED_ETHNICITY', l_cust_b2b_rec.DECLARED_ETHNICITY);
12455 end if;
12456 if trim(l_cust_b2b_rec.DEPARTMENT_INDICATOR) is not null then
12457 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12458 'DEPARTMENT_INDICATOR', l_cust_b2b_rec.DEPARTMENT_INDICATOR);
12459 end if;
12460 if trim(l_cust_b2b_rec.DESCRIPTION) is not null then
12461 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12462 'DESCRIPTION', l_cust_b2b_rec.DESCRIPTION);
12463 end if;
12464 if trim(l_cust_b2b_rec.DISADVANTAGED_INDICATOR) is not null then
12465 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12466 'DISADVANTAGED_INDICATOR', l_cust_b2b_rec.DISADVANTAGED_INDICATOR);
12467 end if;
12468 if trim(l_cust_b2b_rec.ENQUIRY_DUNS) is not null then
12469 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12470 'ENQUIRY_DUNS', l_cust_b2b_rec.ENQUIRY_DUNS);
12471 end if;
12472 if trim(l_cust_b2b_rec.EXPORT_INDICATOR) is not null then
12473 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12474 'EXPORT_INDICATOR', l_cust_b2b_rec.EXPORT_INDICATOR);
12475 end if;
12476 if trim(l_cust_b2b_rec.FAILURE_SCORE) is not null then
12477 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12478 'FAILURE_SCORE', l_cust_b2b_rec.FAILURE_SCORE);
12479 end if;
12480 if trim(l_cust_b2b_rec.FAILURE_SCORE_COMMENTARY) is not null then
12481 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12482 'FAILURE_SCORE_COMMENTARY', l_cust_b2b_rec.FAILURE_SCORE_COMMENTARY);
12483 end if;
12484 if trim(l_cust_b2b_rec.FAILURE_SCORE_OVERRIDE_CODE) is not null then
12485 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12486 'FAILURE_SCORE_OVERRIDE_CODE', l_cust_b2b_rec.FAILURE_SCORE_OVERRIDE_CODE);
12487 end if;
12488 if trim(l_cust_b2b_rec.GLOBAL_FAILURE_SCORE) is not null then
12489 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12490 'GLOBAL_FAILURE_SCORE', l_cust_b2b_rec.GLOBAL_FAILURE_SCORE);
12491 end if;
12492 if trim(l_cust_b2b_rec.HEADQUARTER_BRANCH_INDICATOR) is not null then
12493 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12494 'HEADQUARTER_BRANCH_INDICATOR', l_cust_b2b_rec.HEADQUARTER_BRANCH_INDICATOR);
12495 end if;
12496 if trim(l_cust_b2b_rec.HEAD_OF_HOUSEHOLD_FLAG) is not null then
12497 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12498 'HEAD_OF_HOUSEHOLD_FLAG', l_cust_b2b_rec.HEAD_OF_HOUSEHOLD_FLAG);
12499 end if;
12500 if trim(l_cust_b2b_rec.IMPORT_INDICATOR) is not null then
12501 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12502 'IMPORT_INDICATOR', l_cust_b2b_rec.IMPORT_INDICATOR);
12503 end if;
12504 if trim(l_cust_b2b_rec.ORGANIZATION_KNOWN_AS) is not null then
12505 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12506 'ORGANIZATION_KNOWN_AS', l_cust_b2b_rec.ORGANIZATION_KNOWN_AS);
12507 end if;
12508 if trim(l_cust_b2b_rec.ORGANIZATION_KNOWN_AS2) is not null then
12509 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12510 'ORGANIZATION_KNOWN_AS2', l_cust_b2b_rec.ORGANIZATION_KNOWN_AS2);
12511 end if;
12512 if trim(l_cust_b2b_rec.ORGANIZATION_KNOWN_AS3) is not null then
12513 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12514 'ORGANIZATION_KNOWN_AS3', l_cust_b2b_rec.ORGANIZATION_KNOWN_AS3);
12515 end if;
12516 if trim(l_cust_b2b_rec.ORGANIZATION_KNOWN_AS4) is not null then
12517 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12518 'ORGANIZATION_KNOWN_AS4', l_cust_b2b_rec.ORGANIZATION_KNOWN_AS4);
12519 end if;
12520 if trim(l_cust_b2b_rec.ORGANIZATION_KNOWN_AS5) is not null then
12521 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12522 'ORGANIZATION_KNOWN_AS5', l_cust_b2b_rec.ORGANIZATION_KNOWN_AS5);
12523 end if;
12524
12525 if trim(l_cust_b2b_rec.PERSON_KNOWN_AS) is not null then
12526 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12527 'PERSON_KNOWN_AS', l_cust_b2b_rec.PERSON_KNOWN_AS);
12528 end if;
12529 if trim(l_cust_b2b_rec.PERSON_KNOWN_AS2) is not null then
12530 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12531 'PERSON_KNOWN_AS2', l_cust_b2b_rec.PERSON_KNOWN_AS2);
12532 end if;
12533 if trim(l_cust_b2b_rec.PERSON_KNOWN_AS3) is not null then
12534 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12535 'PERSON_KNOWN_AS3', l_cust_b2b_rec.PERSON_KNOWN_AS3);
12536 end if;
12537 if trim(l_cust_b2b_rec.PERSON_KNOWN_AS4) is not null then
12538 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12539 'PERSON_KNOWN_AS4', l_cust_b2b_rec.PERSON_KNOWN_AS4);
12540 end if;
12541 if trim(l_cust_b2b_rec.PERSON_KNOWN_AS5) is not null then
12542 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12543 'PERSON_KNOWN_AS5', l_cust_b2b_rec.PERSON_KNOWN_AS5);
12544 end if;
12545 if trim(l_cust_b2b_rec.LABOR_SURPLUS_INDICATOR) is not null then
12546 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12547 'LABOR_SURPLUS_INDICATOR', l_cust_b2b_rec.LABOR_SURPLUS_INDICATOR);
12548 end if;
12549 if trim(l_cust_b2b_rec.LOCAL_ACTIVITY_CODE) is not null then
12550 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12551 'LOCAL_ACTIVITY_CODE', l_cust_b2b_rec.LOCAL_ACTIVITY_CODE);
12552 end if;
12553 if trim(l_cust_b2b_rec.LOCAL_ACTIVITY_CODE_TYPE) is not null then
12554 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12555 'LOCAL_ACTIVITY_CODE_TYPE', l_cust_b2b_rec.LOCAL_ACTIVITY_CODE_TYPE);
12556 end if;
12557 if trim(l_cust_b2b_rec.LOCATION_DIRECTIONS) is not null then
12558 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12559 'LOCATION_DIRECTIONS', l_cust_b2b_rec.LOCATION_DIRECTIONS);
12560 end if;
12561 if trim(l_cust_b2b_rec.MARITAL_STATUS) is not null then
12562 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12563 'MARITAL_STATUS', l_cust_b2b_rec.MARITAL_STATUS);
12564 end if;
12565
12566 if trim(l_cust_b2b_rec.MINORITY_OWNED_INDICATOR) is not null then
12567 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12568 'MINORITY_OWNED_INDICATOR', l_cust_b2b_rec.MINORITY_OWNED_INDICATOR);
12569 end if;
12570
12571 if trim(l_cust_b2b_rec.MINORITY_OWNED_TYPE) is not null then
12572 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12573 'MINORITY_OWNED_TYPE', l_cust_b2b_rec.MINORITY_OWNED_TYPE);
12574 end if;
12575
12576 if trim(l_cust_b2b_rec.ORGANIZATION_TYPE) is not null then
12577 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12578 'ORGANIZATION_TYPE', l_cust_b2b_rec.ORGANIZATION_TYPE);
12579 end if;
12580
12581 if trim(l_cust_b2b_rec.OUT_OF_BUSINESS_INDICATOR) is not null then
12582 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12583 'OUT_OF_BUSINESS_INDICATOR', l_cust_b2b_rec.OUT_OF_BUSINESS_INDICATOR);
12584 end if;
12585
12586 if trim(l_cust_b2b_rec.PERSON_ACADEMIC_TITLE) is not null then
12587 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12588 'PERSON_ACADEMIC_TITLE', l_cust_b2b_rec.PERSON_ACADEMIC_TITLE);
12589 end if;
12590 if trim(l_cust_b2b_rec.PERSON_FIRST_NAME_PHONETIC) is not null then
12591 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12592 'PERSON_FIRST_NAME_PHONETIC', l_cust_b2b_rec.PERSON_FIRST_NAME_PHONETIC);
12593 end if;
12594 if trim(l_cust_b2b_rec.PERSON_LAST_NAME_PHONETIC) is not null then
12595 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12596 'PERSON_LAST_NAME_PHONETIC', l_cust_b2b_rec.PERSON_LAST_NAME_PHONETIC);
12597 end if;
12598 if trim(l_cust_b2b_rec.MIDDLE_NAME_PHONETIC) is not null then
12599 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12600 'MIDDLE_NAME_PHONETIC', l_cust_b2b_rec.MIDDLE_NAME_PHONETIC);
12601 end if;
12602 if trim(l_cust_b2b_rec.PERSON_NAME_PHONETIC) is not null then
12603 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12604 'PERSON_NAME_PHONETIC', l_cust_b2b_rec.PERSON_NAME_PHONETIC);
12605 end if;
12606 if trim(l_cust_b2b_rec.PERSON_PREVIOUS_TITLE_NAME) is not null then
12607 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12608 'PERSON_PREVIOUS_TITLE_NAME', l_cust_b2b_rec.PERSON_PREVIOUS_TITLE_NAME);
12609 end if;
12610 if trim(l_cust_b2b_rec.PLACE_OF_BIRTH) is not null then
12611 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12612 'PLACE_OF_BIRTH', l_cust_b2b_rec.PLACE_OF_BIRTH);
12613 end if;
12614 if trim(l_cust_b2b_rec.PRINCIPAL_NAME) is not null then
12615 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12616 'PRINCIPAL_NAME', l_cust_b2b_rec.PRINCIPAL_NAME);
12617 end if;
12618 if trim(l_cust_b2b_rec.PRINCIPAL_TITLE) is not null then
12619 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12620 'PRINCIPAL_TITLE', l_cust_b2b_rec.PRINCIPAL_TITLE);
12621 end if;
12622
12623 if trim(l_cust_b2b_rec.PUBLIC_PRIVATE_OWNERSHIP_FLAG) is not null then
12624 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12625 'PUBLIC_PRIVATE_OWNERSHIP_FLAG', l_cust_b2b_rec.PUBLIC_PRIVATE_OWNERSHIP_FLAG);
12626 end if;
12627 if trim(l_cust_b2b_rec.RENT_OWNED_INDICATOR) is not null then
12628 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12629 'RENT_OWNED_INDICATOR', l_cust_b2b_rec.RENT_OWNED_INDICATOR);
12630 end if;
12631
12632 if trim(l_cust_b2b_rec.SHORT_DESCRIPTION) is not null then
12633 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12634 'SHORT_DESCRIPTION', l_cust_b2b_rec.SHORT_DESCRIPTION);
12635 end if;
12636
12637 if trim(l_cust_b2b_rec.SMALL_BUSINESS_INDICATOR) is not null then
12638 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12639 'SMALL_BUSINESS_INDICATOR', l_cust_b2b_rec.SMALL_BUSINESS_INDICATOR);
12640 end if;
12641
12642 if trim(l_cust_b2b_rec.TAX_ID) is not null then
12643 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12644 'TAX_ID', l_cust_b2b_rec.TAX_ID);
12645 end if;
12646
12647 if trim(l_cust_b2b_rec.WOMAN_OWNED_INDICATOR) is not null then
12648 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12649 'WOMAN_OWNED_INDICATOR', l_cust_b2b_rec.WOMAN_OWNED_INDICATOR);
12650 end if;
12651
12652 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE1) is not null then
12653 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12654 'ORGANIZATION_ATTRIBUTE1', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE1);
12655 end if;
12656 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE2) is not null then
12657 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12658 'ORGANIZATION_ATTRIBUTE2', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE2);
12659 end if;
12660 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE3) is not null then
12661 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12662 'ORGANIZATION_ATTRIBUTE3', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE3);
12663 end if;
12664
12665 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE4) is not null then
12666 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12667 'ORGANIZATION_ATTRIBUTE4', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE4);
12668 end if;
12669 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE5) is not null then
12670 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12671 'ORGANIZATION_ATTRIBUTE5', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE5);
12672 end if;
12673 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE6) is not null then
12674 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12675 'ORGANIZATION_ATTRIBUTE6', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE6);
12676 end if;
12677 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE7) is not null then
12678 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12679 'ORGANIZATION_ATTRIBUTE7', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE7);
12680 end if;
12681 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE8) is not null then
12682 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12683 'ORGANIZATION_ATTRIBUTE8', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE8);
12684 end if;
12685 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE9) is not null then
12686 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12687 'ORGANIZATION_ATTRIBUTE9', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTe9);
12688 end if;
12689 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE10) is not null then
12690 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12691 'ORGANIZATION_ATTRIBUTE10', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE10);
12692 end if;
12693 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE11) is not null then
12694 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12695 'ORGANIZATION_ATTRIBUTE11', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE11);
12696 end if;
12697 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE12) is not null then
12698 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12699 'ORGANIZATION_ATTRIBUTE12', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE12);
12700 end if;
12701 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE13) is not null then
12702 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12703 'ORGANIZATION_ATTRIBUTE13', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE13);
12704 end if;
12705 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE14) is not null then
12706 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12707 'ORGANIZATION_ATTRIBUTE14', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE14);
12708 end if;
12709 if trim(l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE15) is not null then
12710 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12711 'ORGANIZATION_ATTRIBUTE15', l_cust_b2b_rec.ORGANIZATION_ATTRIBUTE15);
12712 end if;
12713
12714 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE1) is not null then
12715 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12716 'ORG_CONTACT_ATTRIBUTE1', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE1);
12717 end if;
12718 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE2) is not null then
12719 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12720 'ORG_CONTACT_ATTRIBUTE2', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE2);
12721 end if;
12722 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE3) is not null then
12723 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12724 'ORG_CONTACT_ATTRIBUTE3', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE3);
12725 end if;
12726 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE4) is not null then
12727 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12728 'ORG_CONTACT_ATTRIBUTE4', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE4);
12729 end if;
12730 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE5) is not null then
12731 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12732 'ORG_CONTACT_ATTRIBUTE5', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE5);
12733 end if;
12734 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE6) is not null then
12735 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12736 'ORG_CONTACT_ATTRIBUTE6', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE6);
12737 end if;
12738 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE7) is not null then
12739 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12740 'ORG_CONTACT_ATTRIBUTE7', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE7);
12741 end if;
12742 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE8) is not null then
12743 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12744 'ORG_CONTACT_ATTRIBUTE8', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE8);
12745 end if;
12746 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE9) is not null then
12747 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12748 'ORG_CONTACT_ATTRIBUTE9', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE9);
12749 end if;
12750 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE10) is not null then
12751 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12752 'ORG_CONTACT_ATTRIBUTE10', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE10);
12753 end if;
12754 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE11) is not null then
12755 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12756 'ORG_CONTACT_ATTRIBUTE11', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE11);
12757 end if;
12758 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE12) is not null then
12759 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12760 'ORG_CONTACT_ATTRIBUTE12', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE12);
12761 end if;
12762 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE13) is not null then
12763 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12764 'ORG_CONTACT_ATTRIBUTE13', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE13);
12765 end if;
12766 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE14) is not null then
12767 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12768 'ORG_CONTACT_ATTRIBUTE14', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE14);
12769 end if;
12770 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE15) is not null then
12771 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12772 'ORG_CONTACT_ATTRIBUTE15', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE15);
12773 end if;
12774
12775 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE1) is not null then
12776 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12777 'ADDRESS_ATTRIBUTE1', l_cust_b2b_rec.ADDRESS_ATTRIBUTE1);
12778 end if;
12779 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE2) is not null then
12780 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12781 'ADDRESS_ATTRIBUTE2', l_cust_b2b_rec.ADDRESS_ATTRIBUTE2);
12782 end if;
12783 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE3) is not null then
12784 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12785 'ADDRESS_ATTRIBUTE3', l_cust_b2b_rec.ADDRESS_ATTRIBUTE3);
12786 end if;
12787 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE4) is not null then
12788 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12789 'ADDRESS_ATTRIBUTE4', l_cust_b2b_rec.ADDRESS_ATTRIBUTE4);
12790 end if;
12791 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE5) is not null then
12792 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12793 'ADDRESS_ATTRIBUTE5', l_cust_b2b_rec.ADDRESS_ATTRIBUTE5);
12794 end if;
12795 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE6) is not null then
12796 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12797 'ADDRESS_ATTRIBUTE6', l_cust_b2b_rec.ADDRESS_ATTRIBUTE6);
12798 end if;
12799 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE7) is not null then
12800 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12801 'ADDRESS_ATTRIBUTE7', l_cust_b2b_rec.ADDRESS_ATTRIBUTE7);
12802 end if;
12803 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE8) is not null then
12804 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12805 'ADDRESS_ATTRIBUTE8', l_cust_b2b_rec.ADDRESS_ATTRIBUTE8);
12806 end if;
12807 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE9) is not null then
12808 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12809 'ADDRESS_ATTRIBUTE9', l_cust_b2b_rec.ADDRESS_ATTRIBUTE9);
12810 end if;
12811 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE10) is not null then
12812 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12813 'ADDRESS_ATTRIBUTE10', l_cust_b2b_rec.ADDRESS_ATTRIBUTE10);
12814 end if;
12815 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE11) is not null then
12816 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12817 'ADDRESS_ATTRIBUTE11', l_cust_b2b_rec.ADDRESS_ATTRIBUTE11);
12818 end if;
12819 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE12) is not null then
12820 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12821 'ADDRESS_ATTRIBUTE12', l_cust_b2b_rec.ADDRESS_ATTRIBUTE12);
12822 end if;
12823 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE13) is not null then
12824 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12825 'ADDRESS_ATTRIBUTE13', l_cust_b2b_rec.ADDRESS_ATTRIBUTE13);
12826 end if;
12827 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE14) is not null then
12828 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12829 'ADDRESS_ATTRIBUTE14', l_cust_b2b_rec.ADDRESS_ATTRIBUTE14);
12830 end if;
12831 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE15) is not null then
12832 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12833 'ADDRESS_ATTRIBUTE15', l_cust_b2b_rec.ADDRESS_ATTRIBUTE15);
12834 end if;
12835
12836 if trim(l_cust_b2b_rec.FAX_COUNTRY_CODE) is not null then
12837 update_element_error (p_import_list_header_id,l_cust_b2b_rec.fx_imp_xml_element_id,
12838 'FAX_COUNTRY_CODE', l_cust_b2b_rec.FAX_COUNTRY_CODE);
12839 end if;
12840 if trim(l_cust_b2b_rec.FAX_AREA_CODE) is not null then
12841 update_element_error (p_import_list_header_id,l_cust_b2b_rec.fx_imp_xml_element_id,
12842 'FAX_AREA_CODE', l_cust_b2b_rec.FAX_AREA_CODE);
12843 end if;
12844 if trim(l_cust_b2b_rec.FAX_NUMBER) is not null then
12845 update_element_error (p_import_list_header_id,l_cust_b2b_rec.fx_imp_xml_element_id,
12846 'FAX_NUMBER', l_cust_b2b_rec.FAX_NUMBER);
12847 end if;
12848 if trim(l_cust_b2b_rec.ORG_ATTRIBUTE_CATEGORY) is not null then
12849 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12850 'ORG_ATTRIBUTE_CATEGORY', l_cust_b2b_rec.ORG_ATTRIBUTE_CATEGORY);
12851 end if;
12852
12853 if trim(l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE_CATEGORY) is not null then
12854 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12855 'ORG_CONTACT_ATTRIBUTE_CATEGORY', l_cust_b2b_rec.ORG_CONTACT_ATTRIBUTE_CATEGORY);
12856 end if;
12857 if trim(l_cust_b2b_rec.ADDRESS_ATTRIBUTE_CATEGORY) is not null then
12858 update_element_error (p_import_list_header_id,l_cust_b2b_rec.add_imp_xml_element_id,
12859 'ADDRESS_ATTRIBUTE_CATEGORY', l_cust_b2b_rec.ADDRESS_ATTRIBUTE_CATEGORY);
12860 end if;
12861 if trim(l_cust_b2b_rec.CONTROL_YEAR) is not null then
12862 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12863 'CONTROL_YEAR', l_cust_b2b_rec.CONTROL_YEAR);
12864 end if;
12865 if trim(l_cust_b2b_rec.DEBARMENTS_COUNT) is not null then
12866 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12867 'DEBARMENTS_COUNT', l_cust_b2b_rec.DEBARMENTS_COUNT);
12868 end if;
12869 if trim(l_cust_b2b_rec.HOUSEHOLD_SIZE) is not null then
12870 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12871 'HOUSEHOLD_SIZE', l_cust_b2b_rec.HOUSEHOLD_SIZE);
12872 end if;
12873 if trim(l_cust_b2b_rec.PERSONAL_INCOME) is not null then
12874 update_element_error (p_import_list_header_id,l_cust_b2b_rec.ocont_imp_xml_element_id,
12875 'PERSONAL_INCOME', l_cust_b2b_rec.PERSONAL_INCOME);
12876 end if;
12877 if trim(l_cust_b2b_rec.NOTES) is not null then
12878 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12879 'NOTES', l_cust_b2b_rec.NOTES);
12880 end if;
12881 if trim(l_cust_b2b_rec.VEHICLE_RESPONSE_CODE) is not null then
12882 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12883 'VEHICLE_RESPONSE_CODE', l_cust_b2b_rec.VEHICLE_RESPONSE_CODE);
12884 end if;
12885 if trim(l_cust_b2b_rec.SALES_AGENT_EMAIL_ID) is not null then
12886 update_element_error (p_import_list_header_id,l_cust_b2b_rec.org_imp_xml_element_id,
12887 'SALES_AGENT_EMAIL_ID', l_cust_b2b_rec.SALES_AGENT_EMAIL_ID);
12888 end if;
12889
12890 -- **********************************
12891 END LOOP;
12892 CLOSE b2b;
12893 end if;
12894
12895 -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
12896 if x_b2b = 'B2C' then
12897 OPEN b2c;
12898 LOOP
12899 FETCH b2c INTO
12900 l_import_source_line_id,
12901 l_import_list_header_id,
12902 l_cust_b2c_rec.per_imp_xml_element_id,
12903 l_cust_b2c_rec.add_imp_xml_element_id,
12904 l_cust_b2c_rec.cp_imp_xml_element_id,
12905 l_cust_b2c_rec.em_imp_xml_element_id,
12906 l_cust_b2c_rec.ADDRESS1,
12907 l_cust_b2c_rec.ADDRESS2,
12908 l_cust_b2c_rec.ADDRESS3,
12909 l_cust_b2c_rec.ADDRESS4,
12910 l_cust_b2c_rec.PERSON_LAST_NAME,
12911 l_cust_b2c_rec.PERSON_FIRST_NAME,
12912 l_cust_b2c_rec.PERSON_NAME_PREFIX,
12913 l_cust_b2c_rec.PERSON_MIDDLE_NAME,
12914 l_cust_b2c_rec.PERSON_NAME_SUFFIX,
12915 -- l_cust_b2c_rec.PERSON_PRE_NAME_ADJUNCT,
12916 l_cust_b2c_rec.CITY,
12917 l_cust_b2c_rec.SALUTATION,
12918 l_cust_b2c_rec.POSTAL_CODE,
12919 l_cust_b2c_rec.STATE,
12920 l_cust_b2c_rec.PROVINCE,
12921 l_cust_b2c_rec.COUNTY,
12922 l_cust_b2c_rec.COUNTRY,
12923 l_cust_b2c_rec.EMAIL_ADDRESS,
12924 l_cust_b2c_rec.PHONE_COUNTRY_CODE,
12925 l_cust_b2c_rec.PHONE_AREA_CODE,
12926 l_cust_b2c_rec.PHONE_NUMBER,
12927 l_cust_b2c_rec.PHONE_EXTENSION,
12928 l_cust_b2c_rec.identifying_address_flag,
12929 l_cust_b2c_rec.ADDRESS_LINES_PHONETIC,
12930 -- bug 4641591: columns obsolete
12931 -- l_cust_b2c_rec.PO_BOX_NUMBER,
12932 -- l_cust_b2c_rec.FLOOR,
12933 -- l_cust_b2c_rec.HOUSE_NUMBER,
12934 l_cust_b2c_rec.POSTAL_PLUS4_CODE,
12935 -- l_cust_b2c_rec.STREET_SUFFIX,
12936 -- l_cust_b2c_rec.STREET,
12937 -- l_cust_b2c_rec.STREET_NUMBER,
12938 -- l_cust_b2c_rec.SUITE,
12939 l_cust_b2c_rec.party_id,
12940 l_cust_b2c_rec.URL,
12941 l_cust_b2c_rec.DECLARED_ETHNICITY,
12942 l_cust_b2c_rec.DESCRIPTION,
12943 l_cust_b2c_rec.HEAD_OF_HOUSEHOLD_FLAG,
12944 l_cust_b2c_rec.PERSON_KNOWN_AS,
12945 l_cust_b2c_rec.PERSON_KNOWN_AS2,
12946 l_cust_b2c_rec.PERSON_KNOWN_AS3,
12947 l_cust_b2c_rec.PERSON_KNOWN_AS4,
12948 l_cust_b2c_rec.PERSON_KNOWN_AS5,
12949 l_cust_b2c_rec.LOCATION_DIRECTIONS,
12950 l_cust_b2c_rec.MARITAL_STATUS,
12951 l_cust_b2c_rec.PERSON_ACADEMIC_TITLE,
12952 l_cust_b2c_rec.PERSON_FIRST_NAME_PHONETIC,
12953 l_cust_b2c_rec.PERSON_LAST_NAME_PHONETIC,
12954 l_cust_b2c_rec.MIDDLE_NAME_PHONETIC,
12955 l_cust_b2c_rec.PERSON_NAME_PHONETIC,
12956 l_cust_b2c_rec.PERSON_PREVIOUS_TITLE_NAME,
12957 -- l_cust_b2c_rec.SECOND_TITLE,
12958 l_cust_b2c_rec.SHORT_DESCRIPTION,
12959 l_cust_b2c_rec.PERSON_ATTRIBUTE1,
12960 l_cust_b2c_rec.PERSON_ATTRIBUTE2,
12961 l_cust_b2c_rec.PERSON_ATTRIBUTE3,
12962 l_cust_b2c_rec.PERSON_ATTRIBUTE4,
12963 l_cust_b2c_rec.PERSON_ATTRIBUTE5,
12964 l_cust_b2c_rec.PERSON_ATTRIBUTE6,
12965 l_cust_b2c_rec.PERSON_ATTRIBUTE7,
12966 l_cust_b2c_rec.PERSON_ATTRIBUTE8,
12967 l_cust_b2c_rec.PERSON_ATTRIBUTE9,
12968 l_cust_b2c_rec.PERSON_ATTRIBUTE10,
12969 l_cust_b2c_rec.PERSON_ATTRIBUTE11,
12970 l_cust_b2c_rec.PERSON_ATTRIBUTE12,
12971 l_cust_b2c_rec.PERSON_ATTRIBUTE13,
12972 l_cust_b2c_rec.PERSON_ATTRIBUTE14,
12973 l_cust_b2c_rec.PERSON_ATTRIBUTE15,
12974 l_cust_b2c_rec.ADDRESS_ATTRIBUTE1,
12975 l_cust_b2c_rec.ADDRESS_ATTRIBUTE2,
12976 l_cust_b2c_rec.ADDRESS_ATTRIBUTE3,
12977 l_cust_b2c_rec.ADDRESS_ATTRIBUTE4,
12978 l_cust_b2c_rec.ADDRESS_ATTRIBUTE5,
12979 l_cust_b2c_rec.ADDRESS_ATTRIBUTE6,
12980 l_cust_b2c_rec.ADDRESS_ATTRIBUTE7,
12981 l_cust_b2c_rec.ADDRESS_ATTRIBUTE8,
12982 l_cust_b2c_rec.ADDRESS_ATTRIBUTE9,
12983 l_cust_b2c_rec.ADDRESS_ATTRIBUTE10,
12984 l_cust_b2c_rec.ADDRESS_ATTRIBUTE11,
12985 l_cust_b2c_rec.ADDRESS_ATTRIBUTE12,
12986 l_cust_b2c_rec.ADDRESS_ATTRIBUTE13,
12987 l_cust_b2c_rec.ADDRESS_ATTRIBUTE14,
12988 l_cust_b2c_rec.ADDRESS_ATTRIBUTE15,
12989 l_cust_b2c_rec.FAX_COUNTRY_CODE,
12990 l_cust_b2c_rec.FAX_AREA_CODE,
12991 l_cust_b2c_rec.FAX_NUMBER,
12992 l_cust_b2c_rec.PERSON_ATTRIBUTE_CATEGORY,
12993 l_cust_b2c_rec.ADDRESS_ATTRIBUTE_CATEGORY,
12994 l_cust_b2c_rec.HOUSEHOLD_SIZE,
12995 l_cust_b2c_rec.PERSONAL_INCOME,
12996 l_cust_b2c_rec.DESCRIPTION,
12997 l_cust_b2c_rec.SHORT_DESCRIPTION,
12998 l_cust_b2c_rec.NOTES,
12999 l_cust_b2c_rec.VEHICLE_RESPONSE_CODE,
13000 l_cust_b2c_rec.SALES_AGENT_EMAIL_ID,
13001 l_cust_b2c_rec.orig_system_reference,
13002 l_cust_b2c_rec.tax_reference,
13003 l_cust_b2c_rec.rent_owned_indicator;
13004 EXIT WHEN b2c%NOTFOUND;
13005
13006 if trim(l_cust_b2c_rec.ADDRESS1) is not null then
13007 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13008 'ADDRESS1', l_cust_b2c_rec.ADDRESS1);
13009 end if;
13010 if trim(l_cust_b2c_rec.ADDRESS2) is not null then
13011 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13012 'ADDRESS2', l_cust_b2c_rec.ADDRESS2);
13013 end if;
13014 if trim(l_cust_b2c_rec.ADDRESS3) is not null then
13015 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13016 'ADDRESS3', l_cust_b2c_rec.ADDRESS3);
13017 end if;
13018 if trim(l_cust_b2c_rec.ADDRESS4) is not null then
13019 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13020 'ADDRESS4', l_cust_b2c_rec.ADDRESS4);
13021 end if;
13022 if trim(l_cust_b2c_rec.PERSON_LAST_NAME) is not null then
13023 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13024 'PERSON_LAST_NAME', l_cust_b2c_rec.PERSON_LAST_NAME);
13025 end if;
13026 if trim(l_cust_b2c_rec.PERSON_FIRST_NAME) is not null then
13027 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13028 'PERSON_FIRST_NAME', l_cust_b2c_rec.PERSON_FIRST_NAME);
13029 end if;
13030 if trim(l_cust_b2c_rec.orig_system_reference) is not null then
13031 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13032 'ORIG_SYSTEM_REFERENCE', l_cust_b2c_rec.ORIG_SYSTEM_REFERENCE);
13033 end if;
13034 if trim(l_cust_b2c_rec.TAX_REFERENCE) is not null then
13035 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13036 'TAX_REFERENCE', l_cust_b2c_rec.TAX_REFERENCE);
13037 end if;
13038 if trim(l_cust_b2c_rec.RENT_OWNED_INDICATOR) is not null then
13039 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13040 'RENT_OWNED_INDICATOR', l_cust_b2c_rec.RENT_OWNED_INDICATOR);
13041 end if;
13042 if trim(l_cust_b2c_rec.PERSON_NAME_PREFIX) is not null then
13043 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13044 'PERSON_NAME_PREFIX', l_cust_b2c_rec.PERSON_NAME_PREFIX);
13045 end if;
13046 if trim(l_cust_b2c_rec.PERSON_MIDDLE_NAME) is not null then
13047 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13048 'PERSON_MIDDLE_NAME', l_cust_b2c_rec.PERSON_MIDDLE_NAME);
13049 end if;
13050 if trim(l_cust_b2c_rec.PERSON_NAME_SUFFIX) is not null then
13051 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13052 'PERSON_NAME_SUFFIX', l_cust_b2c_rec.PERSON_NAME_SUFFIX);
13053 end if;
13054 if trim(l_cust_b2c_rec.CITY) is not null then
13055 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13056 'CITY', l_cust_b2c_rec.CITY);
13057 end if;
13058 if trim(l_cust_b2c_rec.SALUTATION) is not null then
13059 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13060 'SALUTATION', l_cust_b2c_rec.SALUTATION);
13061 end if;
13062 if trim(l_cust_b2c_rec.POSTAL_CODE) is not null then
13063 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13064 'POSTAL_CODE', l_cust_b2c_rec.POSTAL_CODE);
13065 end if;
13066 if trim(l_cust_b2c_rec.STATE) is not null then
13067 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13068 'STATE', l_cust_b2c_rec.STATE);
13069 end if;
13070 if trim(l_cust_b2c_rec.PROVINCE) is not null then
13071 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13072 'PROVINCE', l_cust_b2c_rec.PROVINCE);
13073 end if;
13074 if trim(l_cust_b2c_rec.COUNTY) is not null then
13075 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13076 'COUNTY', l_cust_b2c_rec.COUNTY);
13077 end if;
13078
13079 if trim(l_cust_b2c_rec.COUNTRY) is not null then
13080 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13081 'COUNTRY', l_cust_b2c_rec.COUNTRY);
13082 end if;
13083 if trim(l_cust_b2c_rec.EMAIL_ADDRESS) is not null then
13084 update_element_error (p_import_list_header_id,l_cust_b2c_rec.em_imp_xml_element_id,
13085 'EMAIL_ADDRESS', l_cust_b2c_rec.EMAIL_ADDRESS);
13086 end if;
13087 if trim(l_cust_b2c_rec.PHONE_COUNTRY_CODE) is not null then
13088 update_element_error (p_import_list_header_id,l_cust_b2c_rec.cp_imp_xml_element_id,
13089 'PHONE_COUNTRY_CODE', l_cust_b2c_rec.PHONE_COUNTRY_CODE);
13090 end if;
13091 if trim(l_cust_b2c_rec.PHONE_AREA_CODE) is not null then
13092 update_element_error (p_import_list_header_id,l_cust_b2c_rec.cp_imp_xml_element_id,
13093 'PHONE_AREA_CODE', l_cust_b2c_rec.PHONE_AREA_CODE);
13094 end if;
13095 if trim(l_cust_b2c_rec.PHONE_NUMBER) is not null then
13096 update_element_error (p_import_list_header_id,l_cust_b2c_rec.cp_imp_xml_element_id,
13097 'PHONE_NUMBER', l_cust_b2c_rec.PHONE_NUMBER);
13098 end if;
13099 if trim(l_cust_b2c_rec.PHONE_EXTENSION) is not null then
13100 update_element_error (p_import_list_header_id,l_cust_b2c_rec.cp_imp_xml_element_id,
13101 'PHONE_EXTENSION', l_cust_b2c_rec.PHONE_EXTENSION);
13102 end if;
13103 if trim(l_cust_b2c_rec.identifying_address_flag) is not null then
13104 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13105 'IDENTIFYING_ADDRESS_FLAG', l_cust_b2c_rec.IDENTIFYING_ADDRESS_FLAG);
13106 end if;
13107 if trim(l_cust_b2c_rec.ADDRESS_LINES_PHONETIC) is not null then
13108 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13109 'ADDRESS_LINES_PHONETIC', l_cust_b2c_rec.ADDRESS_LINES_PHONETIC);
13110 end if;
13111 /* -- bug 4641591: columns obsolete
13112 if trim(l_cust_b2c_rec.PO_BOX_NUMBER) is not null then
13113 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13114 'PO_BOX_NUMBER', l_cust_b2c_rec.PO_BOX_NUMBER);
13115 end if;
13116 if trim(l_cust_b2c_rec.FLOOR) is not null then
13117 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13118 'FLOOR', l_cust_b2c_rec.FLOOR);
13119 end if;
13120 if trim(l_cust_b2c_rec.HOUSE_NUMBER) is not null then
13121 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13122 'HOUSE_NUMBER', l_cust_b2c_rec.HOUSE_NUMBER);
13123 end if;
13124 */
13125 if trim(l_cust_b2c_rec.POSTAL_PLUS4_CODE) is not null then
13126 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13127 'POSTAL_PLUS4_CODE', l_cust_b2c_rec.POSTAL_PLUS4_CODE);
13128 end if;
13129 /* -- bug 4641591: columns obsolete
13130 if trim(l_cust_b2c_rec.STREET_SUFFIX) is not null then
13131 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13132 'STREET_SUFFIX', l_cust_b2c_rec.STREET_SUFFIX);
13133 end if;
13134 if trim(l_cust_b2c_rec.STREET) is not null then
13135 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13136 'STREET', l_cust_b2c_rec.STREET);
13137 end if;
13138 if trim(l_cust_b2c_rec.STREET_NUMBER) is not null then
13139 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13140 'STREET_NUMBER', l_cust_b2c_rec.STREET_NUMBER);
13141 end if;
13142 if trim(l_cust_b2c_rec.SUITE) is not null then
13143 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13144 'SUITE', l_cust_b2c_rec.SUITE);
13145 end if;
13146 */
13147 if trim(l_cust_b2c_rec.party_id) is not null then
13148 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13149 'PARTY_ID', l_cust_b2c_rec.PARTY_ID);
13150 end if;
13151
13152 if trim(l_cust_b2c_rec.URL) is not null then
13153 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13154 'URL', l_cust_b2c_rec.URL);
13155 end if;
13156 if trim(l_cust_b2c_rec.DECLARED_ETHNICITY) is not null then
13157 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13158 'DECLARED_ETHNICITY', l_cust_b2c_rec.DECLARED_ETHNICITY);
13159 end if;
13160 if trim(l_cust_b2c_rec.DESCRIPTION) is not null then
13161 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13162 'DESCRIPTION', l_cust_b2c_rec.DESCRIPTION);
13163 end if;
13164 if trim(l_cust_b2c_rec.HEAD_OF_HOUSEHOLD_FLAG) is not null then
13165 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13166 'HEAD_OF_HOUSEHOLD_FLAG', l_cust_b2c_rec.HEAD_OF_HOUSEHOLD_FLAG);
13167 end if;
13168 if trim(l_cust_b2c_rec.PERSON_KNOWN_AS) is not null then
13169 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13170 'PERSON_KNOWN_AS', l_cust_b2c_rec.PERSON_KNOWN_AS);
13171 end if;
13172 if trim(l_cust_b2c_rec.PERSON_KNOWN_AS2) is not null then
13173 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13174 'PERSON_KNOWN_AS2', l_cust_b2c_rec.PERSON_KNOWN_AS2);
13175 end if;
13176 if trim(l_cust_b2c_rec.PERSON_KNOWN_AS3) is not null then
13177 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13178 'PERSON_KNOWN_AS3', l_cust_b2c_rec.PERSON_KNOWN_AS3);
13179 end if;
13180 if trim(l_cust_b2c_rec.PERSON_KNOWN_AS4) is not null then
13181 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13182 'PERSON_KNOWN_AS4', l_cust_b2c_rec.PERSON_KNOWN_AS4);
13183 end if;
13184 if trim(l_cust_b2c_rec.PERSON_KNOWN_AS5) is not null then
13185 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13186 'PERSON_KNOWN_AS5', l_cust_b2c_rec.PERSON_KNOWN_AS5);
13187 end if;
13188
13189 if trim(l_cust_b2c_rec.LOCATION_DIRECTIONS) is not null then
13190 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13191 'LOCATION_DIRECTIONS', l_cust_b2c_rec.LOCATION_DIRECTIONS);
13192 end if;
13193 if trim(l_cust_b2c_rec.MARITAL_STATUS) is not null then
13194 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13195 'MARITAL_STATUS', l_cust_b2c_rec.MARITAL_STATUS);
13196 end if;
13197 if trim(l_cust_b2c_rec.PERSON_ACADEMIC_TITLE) is not null then
13198 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13199 'PERSON_ACADEMIC_TITLE', l_cust_b2c_rec.PERSON_ACADEMIC_TITLE);
13200 end if;
13201 if trim(l_cust_b2c_rec.PERSON_FIRST_NAME_PHONETIC) is not null then
13202 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13203 'PERSON_FIRST_NAME_PHONETIC', l_cust_b2c_rec.PERSON_FIRST_NAME_PHONETIC);
13204 end if;
13205 if trim(l_cust_b2c_rec.PERSON_LAST_NAME_PHONETIC) is not null then
13206 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13207 'PERSON_LAST_NAME_PHONETIC', l_cust_b2c_rec.PERSON_LAST_NAME_PHONETIC);
13208 end if;
13209 if trim(l_cust_b2c_rec.MIDDLE_NAME_PHONETIC) is not null then
13210 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13211 'MIDDLE_NAME_PHONETIC', l_cust_b2c_rec.MIDDLE_NAME_PHONETIC);
13212 end if;
13213 if trim(l_cust_b2c_rec.PERSON_NAME_PHONETIC) is not null then
13214 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13215 'PERSON_NAME_PHONETIC', l_cust_b2c_rec.PERSON_NAME_PHONETIC);
13216 end if;
13217 if trim(l_cust_b2c_rec.PERSON_PREVIOUS_TITLE_NAME) is not null then
13218 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13219 'PERSON_PREVIOUS_TITLE_NAME', l_cust_b2c_rec.PERSON_PREVIOUS_TITLE_NAME);
13220 end if;
13221 if trim(l_cust_b2c_rec.SHORT_DESCRIPTION) is not null then
13222 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13223 'SHORT_DESCRIPTION', l_cust_b2c_rec.SHORT_DESCRIPTION);
13224 end if;
13225 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE1) is not null then
13226 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13227 'PERSON_ATTRIBUTE1', l_cust_b2c_rec.PERSON_ATTRIBUTE1);
13228 end if;
13229 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE2) is not null then
13230 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13231 'PERSON_ATTRIBUTE2', l_cust_b2c_rec.PERSON_ATTRIBUTE2);
13232 end if;
13233 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE3) is not null then
13234 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13235 'PERSON_ATTRIBUTE3', l_cust_b2c_rec.PERSON_ATTRIBUTE3);
13236 end if;
13237 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE4) is not null then
13238 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13239 'PERSON_ATTRIBUTE4', l_cust_b2c_rec.PERSON_ATTRIBUTE4);
13240 end if;
13241 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE5) is not null then
13242 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13243 'PERSON_ATTRIBUTE5', l_cust_b2c_rec.PERSON_ATTRIBUTE5);
13244 end if;
13245 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE6) is not null then
13246 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13247 'PERSON_ATTRIBUTE6', l_cust_b2c_rec.PERSON_ATTRIBUTE6);
13248 end if;
13249 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE7) is not null then
13250 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13251 'PERSON_ATTRIBUTE7', l_cust_b2c_rec.PERSON_ATTRIBUTE7);
13252 end if;
13253 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE8) is not null then
13254 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13255 'PERSON_ATTRIBUTE8', l_cust_b2c_rec.PERSON_ATTRIBUTE8);
13256 end if;
13257 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE9) is not null then
13258 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13259 'PERSON_ATTRIBUTE9', l_cust_b2c_rec.PERSON_ATTRIBUTE9);
13260 end if;
13261 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE10) is not null then
13262 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13263 'PERSON_ATTRIBUTE10', l_cust_b2c_rec.PERSON_ATTRIBUTE10);
13264 end if;
13265 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE11) is not null then
13266 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13267 'PERSON_ATTRIBUTE11', l_cust_b2c_rec.PERSON_ATTRIBUTE11);
13268 end if;
13269 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE12) is not null then
13270 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13271 'PERSON_ATTRIBUTE12', l_cust_b2c_rec.PERSON_ATTRIBUTE12);
13272 end if;
13273 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE13) is not null then
13274 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13275 'PERSON_ATTRIBUTE13', l_cust_b2c_rec.PERSON_ATTRIBUTE13);
13276 end if;
13277 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE14) is not null then
13278 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13279 'PERSON_ATTRIBUTE14', l_cust_b2c_rec.PERSON_ATTRIBUTE14);
13280 end if;
13281 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE15) is not null then
13282 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13283 'PERSON_ATTRIBUTE15', l_cust_b2c_rec.PERSON_ATTRIBUTE15);
13284 end if;
13285
13286 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE1) is not null then
13287 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13288 'ADDRESS_ATTRIBUTE1', l_cust_b2c_rec.ADDRESS_ATTRIBUTE1);
13289 end if;
13290 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE2) is not null then
13291 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13292 'ADDRESS_ATTRIBUTE2', l_cust_b2c_rec.ADDRESS_ATTRIBUTE2);
13293 end if;
13294 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE3) is not null then
13295 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13296 'ADDRESS_ATTRIBUTE3', l_cust_b2c_rec.ADDRESS_ATTRIBUTE3);
13297 end if;
13298 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE4) is not null then
13299 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13300 'ADDRESS_ATTRIBUTE4', l_cust_b2c_rec.ADDRESS_ATTRIBUTE4);
13301 end if;
13302 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE5) is not null then
13303 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13304 'ADDRESS_ATTRIBUTE5', l_cust_b2c_rec.ADDRESS_ATTRIBUTE5);
13305 end if;
13306 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE6) is not null then
13307 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13308 'ADDRESS_ATTRIBUTE6', l_cust_b2c_rec.ADDRESS_ATTRIBUTE6);
13309 end if;
13310 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE7) is not null then
13311 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13312 'ADDRESS_ATTRIBUTE7', l_cust_b2c_rec.ADDRESS_ATTRIBUTE7);
13313 end if;
13314 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE8) is not null then
13315 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13316 'ADDRESS_ATTRIBUTE8', l_cust_b2c_rec.ADDRESS_ATTRIBUTE8);
13317 end if;
13318 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE9) is not null then
13319 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13320 'ADDRESS_ATTRIBUTE9', l_cust_b2c_rec.ADDRESS_ATTRIBUTE9);
13321 end if;
13322 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE10) is not null then
13323 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13324 'ADDRESS_ATTRIBUTE11', l_cust_b2c_rec.ADDRESS_ATTRIBUTE11);
13325 end if;
13326 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE12) is not null then
13327 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13328 'ADDRESS_ATTRIBUTE12', l_cust_b2c_rec.ADDRESS_ATTRIBUTE12);
13329 end if;
13330 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE13) is not null then
13331 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13332 'ADDRESS_ATTRIBUTE13', l_cust_b2c_rec.ADDRESS_ATTRIBUTE13);
13333 end if;
13334 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE14) is not null then
13335 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13336 'ADDRESS_ATTRIBUTE14', l_cust_b2c_rec.ADDRESS_ATTRIBUTE14);
13337 end if;
13338 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE15) is not null then
13339 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13340 'ADDRESS_ATTRIBUTE15', l_cust_b2c_rec.ADDRESS_ATTRIBUTE15);
13341 end if;
13342 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE11) is not null then
13343 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13344 'ADDRESS_ATTRIBUTE11', l_cust_b2c_rec.ADDRESS_ATTRIBUTE11);
13345 end if;
13346 if trim(l_cust_b2c_rec.FAX_COUNTRY_CODE) is not null then
13347 update_element_error (p_import_list_header_id,l_cust_b2c_rec.fx_imp_xml_element_id,
13348 'FAX_COUNTRY_CODE', l_cust_b2c_rec.FAX_COUNTRY_CODE);
13349 end if;
13350 if trim(l_cust_b2c_rec.FAX_AREA_CODE) is not null then
13351 update_element_error (p_import_list_header_id,l_cust_b2c_rec.fx_imp_xml_element_id,
13352 'FAX_AREA_CODE', l_cust_b2c_rec.FAX_AREA_CODE);
13353 end if;
13354 if trim(l_cust_b2c_rec.FAX_NUMBER) is not null then
13355 update_element_error (p_import_list_header_id,l_cust_b2c_rec.fx_imp_xml_element_id,
13356 'FAX_NUMBER', l_cust_b2c_rec.FAX_NUMBER);
13357 end if;
13358
13359 if trim(l_cust_b2c_rec.PERSON_ATTRIBUTE_CATEGORY) is not null then
13360 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13361 'PERSON_ATTRIBUTE_CATEGORY', l_cust_b2c_rec.PERSON_ATTRIBUTE_CATEGORY);
13362 end if;
13363 if trim(l_cust_b2c_rec.ADDRESS_ATTRIBUTE_CATEGORY) is not null then
13364 update_element_error (p_import_list_header_id,l_cust_b2c_rec.add_imp_xml_element_id,
13365 'ADDRESS_ATTRIBUTE_CATEGORY', l_cust_b2c_rec.ADDRESS_ATTRIBUTE_CATEGORY);
13366 end if;
13367 if trim(l_cust_b2c_rec.HOUSEHOLD_SIZE) is not null then
13368 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13369 'HOUSEHOLD_SIZE', l_cust_b2c_rec.HOUSEHOLD_SIZE);
13370 end if;
13371 if trim(l_cust_b2c_rec.PERSONAL_INCOME) is not null then
13372 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13373 'PERSONAL_INCOME', l_cust_b2c_rec.PERSONAL_INCOME);
13374 end if;
13375 if trim(l_cust_b2c_rec.DESCRIPTION) is not null then
13376 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13377 'DESCRIPTION', l_cust_b2c_rec.DESCRIPTION);
13378 end if;
13379 if trim(l_cust_b2c_rec.SHORT_DESCRIPTION) is not null then
13380 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13381 'SHORT_DESCRIPTION', l_cust_b2c_rec.SHORT_DESCRIPTION);
13382 end if;
13383 if trim(l_cust_b2c_rec.NOTES) is not null then
13384 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13385 'NOTES', l_cust_b2c_rec.NOTES);
13386 end if;
13387 if trim(l_cust_b2c_rec.VEHICLE_RESPONSE_CODE) is not null then
13388 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13389 'VEHICLE_RESPONSE_CODE', l_cust_b2c_rec.VEHICLE_RESPONSE_CODE);
13390 end if;
13391 if trim(l_cust_b2c_rec.SALES_AGENT_EMAIL_ID) is not null then
13392 update_element_error (p_import_list_header_id,l_cust_b2c_rec.per_imp_xml_element_id,
13393 'SALES_AGENT_EMAIL_ID', l_cust_b2c_rec.SALES_AGENT_EMAIL_ID);
13394 end if;
13395
13396 END LOOP;
13397 CLOSE b2c;
13398 end if;
13399
13400 -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
13401
13402 EXCEPTION
13403 WHEN OTHERS THEN
13404 p_return_status := FND_API.G_RET_STS_ERROR;
13405 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
13406 FND_MESSAGE.Set_Token('ROW','Error in exe_custxml_data_validation:' || SQLERRM||' '||SQLCODE);
13407 AMS_Utility_PVT.Create_Log (
13408 x_return_status => l_return_status,
13409 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13410 p_log_used_by_id => p_import_list_header_id,
13411 p_msg_data => FND_MESSAGE.get,
13412 p_msg_type => 'DEBUG'
13413 );
13414
13415 end exe_custxml_data_validation;
13416 -- ----------------------------------------------
13417
13418 procedure create_contact_point(
13419 p_cpoint_rec IN hz_contact_point_v2pub.contact_point_rec_type,
13420 p_edi_rec IN hz_contact_point_v2pub.edi_rec_type,
13421 p_email_rec IN hz_contact_point_v2pub.email_rec_type,
13422 p_phone_rec IN hz_contact_point_v2pub.phone_rec_type,
13423 p_telex_rec IN hz_contact_point_v2pub.telex_rec_type,
13424 p_web_rec IN hz_contact_point_v2pub.web_rec_type,
13425 x_return_status OUT NOCOPY VARCHAR2,
13426 x_msg_count OUT NOCOPY NUMBER,
13427 x_msg_data OUT NOCOPY VARCHAR2,
13428 x_contact_point_id OUT NOCOPY NUMBER
13429 ) is
13430
13431 cpoint_rec hz_contact_point_v2pub.contact_point_rec_type := p_cpoint_rec;
13432 email_rec hz_contact_point_v2pub.email_rec_type := p_email_rec;
13433 phone_rec hz_contact_point_v2pub.phone_rec_type := p_phone_rec;
13434 edi_rec hz_contact_point_v2pub.edi_rec_type := p_edi_rec;
13435 telex_rec hz_contact_point_v2pub.telex_rec_type := p_telex_rec;
13436 web_rec hz_contact_point_v2pub.web_rec_type := p_web_rec ;
13437
13438 begin
13439 SELECT hz_contact_points_s.nextval into x_contact_point_id from dual;
13440
13441 cpoint_rec.contact_point_id := x_contact_point_id;
13442 cpoint_rec.orig_system_reference := x_contact_point_id;
13443 cpoint_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
13444 cpoint_rec.application_id := 530;
13445 hz_contact_point_v2pub.create_contact_point(
13446 'F',
13447 cpoint_rec,
13448 edi_rec,
13449 email_rec,
13450 phone_rec,
13451 telex_rec,
13452 web_rec,
13453 x_contact_point_id,
13454 x_return_status,
13455 x_msg_count,
13456 x_msg_data);
13457
13458 end create_contact_point;
13459 -- ---------------------------------------------------------------------
13460 --
13461 -- This procedure is used for existence checking for address.
13462 --
13463 --
13464 PROCEDURE address_echeck(
13465 p_party_id IN NUMBER,
13466 x_return_status OUT NOCOPY VARCHAR2,
13467 x_msg_count OUT NOCOPY NUMBER,
13468 x_msg_data OUT NOCOPY VARCHAR2,
13469 p_location_id IN OUT NOCOPY NUMBER,
13470 p_address1 IN VARCHAR2,
13471 p_city IN VARCHAR2,
13472 p_pcode IN VARCHAR2,
13473 p_country IN VARCHAR2
13474 ) is
13475
13476 l_address_key varchar(1000);
13477 l_loc_id number;
13478 l_ret_status varchar(1);
13479
13480
13481 cursor c_addr_ps is
13482 select max(loc.location_id)
13483 from hz_party_sites ps, hz_locations loc
13484 where ps.party_id = p_party_id
13485 and ps.location_id = loc.location_id
13486 and loc.address_key = l_address_key
13487 and loc.country = p_country
13488 and nvl(loc.city,nvl(p_city,'x')) = nvl(p_city,'x');
13489
13490 cursor c_addr is
13491 select max(loc.location_id)
13492 from hz_locations loc
13493 where loc.address_key = l_address_key
13494 and loc.country = p_country
13495 and nvl(loc.city,nvl(p_city,'x')) = nvl(p_city,'x');
13496
13497 begin
13498 x_return_status := FND_API.g_ret_sts_success;
13499 l_address_key := hz_fuzzy_pub.Generate_Key (
13500 p_key_type => 'ADDRESS',
13501 p_address1 => p_address1,
13502 p_postal_code => p_pcode
13503 );
13504
13505 open c_addr_ps;
13506 fetch c_addr_ps into l_loc_id;
13507 close c_addr_ps;
13508 if l_loc_id is null then
13509 open c_addr;
13510 fetch c_addr into l_loc_id;
13511 close c_addr;
13512 end if;
13513 p_location_id := l_loc_id;
13514 exception
13515 when others then
13516 x_return_status := FND_API.g_ret_sts_unexp_error ;
13517 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
13518 FND_MSG_PUB.add_exc_msg(g_pkg_name,'address_echeck');
13519 END IF;
13520 FND_MSG_PUB.count_and_get(
13521 p_encoded => FND_API.g_false,
13522 p_count => x_msg_count,
13523 p_data => x_msg_data
13524 );
13525
13526 end address_echeck;
13527 -- --------------------------------------------------
13528
13529 procedure create_location (
13530 p_location_rec IN HZ_LOCATION_v2PUB.LOCATION_REC_TYPE,
13531 x_return_status OUT NOCOPY VARCHAR2,
13532 x_msg_count OUT NOCOPY NUMBER,
13533 x_msg_data OUT NOCOPY VARCHAR2,
13534 x_location_id OUT NOCOPY NUMBER
13535 ) IS
13536
13537 location_rec hz_location_v2pub.location_rec_type := p_location_rec;
13538
13539 BEGIN
13540
13541 select hr_locations_s.nextval into x_location_id from dual;
13542 location_rec.location_id := x_location_Id;
13543 location_rec.orig_system_reference := x_location_id ;
13544 location_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
13545 location_rec.application_id := 530;
13546
13547 hz_location_v2pub.create_location(
13548 'F',
13549 location_rec,
13550 x_location_id,
13551 x_return_status,
13552 x_msg_count,
13553 x_msg_data
13554 );
13555
13556 end create_location;
13557
13558 -- --------------------------------------------------------
13559
13560 procedure create_party_site (
13561 p_psite_rec IN hz_party_site_v2pub.party_site_rec_type,
13562 x_return_status OUT NOCOPY VARCHAR2,
13563 x_msg_count OUT NOCOPY NUMBER,
13564 x_msg_data OUT NOCOPY VARCHAR2,
13565 x_party_site_id OUT NOCOPY NUMBER,
13566 x_party_site_number OUT NOCOPY VARCHAR2
13567 ) IS
13568
13569 x_gen_party_site_number VARCHAR2(1);
13570 psite_rec hz_party_site_v2pub.party_site_rec_type := p_psite_rec;
13571
13572 begin
13573 x_gen_party_site_number := fnd_profile.value('HZ_GENERATE_PARTY_SITE_NUMBER');
13574 x_party_site_number := null;
13575 select hz_party_sites_s.nextval into x_party_site_id from dual;
13576 if x_gen_party_site_number = 'N' then
13577 select hz_party_site_number_s.nextval into x_party_site_number from dual;
13578 end if;
13579
13580 psite_rec.party_site_id := x_party_site_id;
13581 psite_rec.party_site_number := x_party_site_number;
13582 psite_rec.orig_system_reference := x_party_site_id;
13583 psite_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
13584 psite_rec.application_id := 530;
13585 /*
13586 hz_party_pub.create_party_site(
13587 1,
13588 'T',
13589 'F',
13590 psite_rec,
13591 x_return_status,
13592 x_msg_count,
13593 x_msg_data,
13594 x_party_site_id,
13595 x_party_site_number
13596 );
13597 */
13598 hz_party_site_v2pub.create_party_site(
13599 'F',
13600 psite_rec,
13601 x_party_site_id,
13602 x_party_site_number,
13603 x_return_status,
13604 x_msg_count,
13605 x_msg_data
13606 );
13607 end create_party_site;
13608 -- -------------------------------------------------------
13609
13610 PROCEDURE client_load_direct (
13611 p_import_list_header_id IN NUMBER,
13612 p_owner_user_id IN NUMBER,
13613 p_generate_list IN VARCHAR2 ,
13614 p_list_name IN VARCHAR2 -- For list generation name.
13615 ) IS
13616 l_import_type VARCHAR2(30);
13617 l_msg_code NUMBER;
13618 l_msg_buf VARCHAR2(4000);
13619 l_batch_id NUMBER;
13620 l_lookup_code VARCHAR2(30);
13621 l_return_status VARCHAR2(1);
13622 i_return_status VARCHAR2(1);
13623 l_dedupe_flag VARCHAR2(1);
13624 l_validate_file VARCHAR2(1);
13625 i_msg_data VARCHAR2(2000);
13626 i_msg_buf VARCHAR2(4000);
13627 i_msg_count NUMBER;
13628 l_list_header_id NUMBER;
13629 l_duplicate_records NUMBER;
13630 l_user_status_id NUMBER;
13631
13632 x_rstatus VARCHAR2(1);
13633 x_mdata VARCHAR2(2000);
13634 x_mcount NUMBER;
13635
13636 l_lead_status VARCHAR2(30);
13637 i_processed_records NUMBER;
13638 i_failed_records NUMBER;
13639 l_request_id NUMBER;
13640 l_conc_prog_name VARCHAR2(60);
13641 l_finish_status VARCHAR2(30);
13642 l_status_code VARCHAR2(30);
13643
13644 l_error_exist VARCHAR2(1);
13645 l_execute_mode VARCHAR2(1);
13646 l_rec_in_stag_tab VARCHAR2(1);
13647 l_loaded_records NUMBER;
13648 l_failed_records NUMBER;
13649 l_string VARCHAR2(4000);
13650 l_program varchar2(100);
13651 l_file_type VARCHAR2(30);
13652 l_loaded_rows NUMBER;
13653 l_rec_update_flag VARCHAR2(1);
13654 x_tmp_var VARCHAR2(4000);
13655 x_tmp_var1 VARCHAR2(4000);
13656 L_TOTAL_RECORDS NUMBER;
13657 l_numb_of_inst number;
13658 x_hz_dup_check VARCHAR2(60);
13659 l_b2b_flag VARCHAR2(1);
13660 x_import_list_header_id number;
13661 X_RETURN_STATUS VARCHAR2(1);
13662 x_msg_count NUMBER;
13663 x_msg_data VARCHAR2(2000);
13664 l_osr_mapped VARCHAR2(1);
13665
13666 L_MESG_TEXT varchar2(2000);
13667
13668 cursor c_import_type is
13669 select import_type, dedupe_flag, nvl(VALIDATE_FILE,'N'),status_code,EXECUTE_MODE,nvl(RECORD_UPDATE_FLAG,'N')
13670 ,nvl(NUMBER_OF_INSTANCES,1) from ams_imp_list_headers_all
13671 where import_list_header_id = p_import_list_header_id;
13672
13673 cursor c_dup_recs is
13674 select count(*) from ams_imp_source_lines
13675 where import_list_header_id = p_import_list_header_id
13676 and duplicate_flag = 'Y';
13677
13678 cursor c_event_status is
13679 select nvl(PROCESSED_ROWS,0), nvl(NUMBER_OF_FAILED_RECORDS,0)
13680 from ams_imp_list_headers_all
13681 where import_list_header_id = p_import_list_header_id;
13682
13683 cursor c_conc_name is
13684 SELECT concurrent_program FROM ams_imp_list_import_types
13685 where import_type = 'LEAD';
13686
13687 cursor c_error_exist is
13688 select 'Y' from ams_list_import_errors
13689 where import_list_header_id = p_import_list_header_id
13690 and error_type = 'E'
13691 and rownum < 2;
13692
13693 cursor c_rec_in_stag_tab is
13694 select 'Y' from ams_imp_source_lines
13695 where import_list_header_id = p_import_list_header_id
13696 and load_status in ('ACTIVE','RELOAD')
13697 and rownum < 2;
13698
13699 cursor c_rec_in_xml_stag_tab is
13700 select 'Y' from ams_imp_xml_elements e, ams_imp_documents d
13701 where d.import_list_header_id = p_import_list_header_id
13702 and d.imp_document_id = e.imp_xml_document_id
13703 and e.load_status in ('ACTIVE','RELOAD')
13704 and rownum < 2;
13705
13706 cursor c_loaded_records is
13707 select count(*) from ams_imp_source_lines
13708 where import_list_header_id = p_import_list_header_id
13709 and load_status = G_STATUS_SUCCESS;
13710
13711 cursor c_failed_records is
13712 select count(*) from ams_imp_source_lines
13713 where import_list_header_id = p_import_list_header_id
13714 and load_status = G_STATUS_ERROR;
13715
13716 cursor c_prog_name (x_imp_type varchar2) is
13717 SELECT concurrent_program FROM ams_imp_list_import_types
13718 where import_type = x_imp_type;
13719
13720 cursor c_file_type is
13721 select file_type from ams_imp_documents where import_list_header_id = p_import_list_header_id;
13722
13723 cursor c_total_records is
13724 select count(*) from ams_imp_source_lines
13725 where import_list_header_id = p_import_list_header_id
13726 and load_status in ('ACTIVE','RELOAD');
13727
13728 -- For Mapped osr
13729 cursor osr_mapped is
13730 SELECT 'Y' FROM ams_list_src_fields sf,
13731 ams_imp_list_headers_all hd
13732 WHERE sf.field_column_name = 'ORIG_SYSTEM_REFERENCE'
13733 AND sf.enabled_flag = 'Y'
13734 AND sf.list_source_type_id = hd.list_source_type_id
13735 and hd.import_type in ('B2B','B2C')
13736 AND hd.import_list_header_id = p_import_list_header_id;
13737
13738 begin
13739 x_import_list_header_id := p_import_list_header_id;
13740 x_hz_dup_check := fnd_profile.value('AMS_HZ_DEDUPE_RULE');
13741 if x_hz_dup_check <> 'Y' then
13742 x_hz_dup_check := 'N';
13743 end if;
13744
13745 open c_import_type;
13746 fetch c_import_type into l_import_type, l_dedupe_flag,l_validate_file,l_status_code,l_execute_mode,
13747 l_rec_update_flag,l_numb_of_inst;
13748 close c_import_type;
13749 open c_conc_name;
13750 fetch c_conc_name into l_conc_prog_name;
13751 close c_conc_name;
13752 open osr_mapped;
13753 fetch osr_mapped into l_osr_mapped;
13754 close osr_mapped;
13755
13756 open c_file_type;
13757 fetch c_file_type into l_file_type;
13758 close c_file_type;
13759 if l_file_type = 'CSV' then
13760 open c_rec_in_stag_tab;
13761 fetch c_rec_in_stag_tab into l_rec_in_stag_tab;
13762 close c_rec_in_stag_tab;
13763 end if;
13764 if l_file_type = 'XML' then
13765 open c_rec_in_xml_stag_tab;
13766 fetch c_rec_in_xml_stag_tab into l_rec_in_stag_tab;
13767 close c_rec_in_xml_stag_tab;
13768 end if;
13769 if l_rec_in_stag_tab is NULL then
13770 AMS_Utility_PVT.Create_Log (
13771 x_return_status => l_return_status,
13772 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13773 p_log_used_by_id => p_import_list_header_id,
13774 p_msg_data => 'Aborting import process, Staging table not populated.',
13775 p_msg_type => 'DEBUG'
13776 );
13777 l_lookup_code := 'ERROR';
13778 l_user_status_id := null;
13779 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
13780 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
13781 system_status_code = 'ERROR' and default_flag = 'Y';
13782
13783 UPDATE ams_imp_list_headers_all
13784 set status_code = l_lookup_code,
13785 user_status_id = l_user_status_id,
13786 status_date = sysdate
13787 where import_list_header_id = p_import_list_header_id;
13788 return;
13789 end if;
13790 -- ------------------------------------------------------
13791 -- ------------RAISE PRE BUSINESS EVENT START ---------------------
13792
13793 Raise_Business_event(p_import_list_header_id,
13794 'oracle.apps.ams.list.ListImportPreEvent');
13795
13796 -- ------------RAISE PRE BUSINESS EVENT END ---------------------
13797 -- ------------------------------------------------------
13798 if l_execute_mode = 'R' then
13799 l_lookup_code := 'STAGED';
13800 l_status_code := 'STAGED';
13801 l_user_status_id := null;
13802 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
13803 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
13804 system_status_code = 'STAGED' and default_flag = 'Y';
13805
13806 select as_import_interface_s.nextval into l_batch_id from dual;
13807
13808 UPDATE ams_imp_list_headers_all
13809 set status_code = l_lookup_code,
13810 user_status_id = l_user_status_id,
13811 batch_id = l_batch_id,
13812 status_date = sysdate
13813 where import_list_header_id = p_import_list_header_id;
13814
13815 UPDATE ams_imp_source_lines
13816 set batch_id = l_batch_id,
13817 request_id = NULL
13818 where import_list_header_id = p_import_list_header_id
13819 and load_status in ('RELOAD','ACTIVE');
13820
13821 AMS_Utility_PVT.Create_Log (
13822 x_return_status => l_return_status,
13823 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13824 p_log_used_by_id => p_import_list_header_id,
13825 p_msg_data => 'Starting List Import in RELOAD Mode.',
13826 p_msg_type => 'DEBUG'
13827 );
13828 end if;
13829
13830 AMS_Utility_PVT.Create_Log (
13831 x_return_status => l_return_status,
13832 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13833 p_log_used_by_id => p_import_list_header_id,
13834 p_msg_data => 'Starting Import process.',
13835 p_msg_type => 'DEBUG'
13836 );
13837
13838 if (l_import_type = 'B2B' or l_import_type = 'B2C') then
13839 if l_status_code = 'STAGED' then
13840 if l_file_type = 'XML' and l_execute_mode <> 'R' then
13841 Process_customers_xml (
13842 1, -- p_api_version_number
13843 FND_API.G_FALSE , -- p_init_msg_list
13844 FND_API.G_FALSE , -- p_commit
13845 FND_API.G_VALID_LEVEL_FULL, -- p_validation_level
13846 x_rstatus ,
13847 x_mcount ,
13848 x_mdata ,
13849 p_import_list_header_id ,
13850 l_rec_update_flag -- p_update_flag
13851 );
13852 if x_mcount > 1 then
13853 FOR i IN 1..x_mcount LOOP
13854 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
13855 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
13856 END LOOP;
13857 x_mdata := x_tmp_var1;
13858 END IF;
13859 if x_rstatus <> 'S' then
13860 AMS_Utility_PVT.Create_Log (
13861 x_return_status => l_return_status,
13862 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13863 p_log_used_by_id => p_import_list_header_id,
13864 p_msg_data => 'Error while executing Process_customers_xml process.',
13865 p_msg_type => 'DEBUG'
13866 );
13867 AMS_List_Import_PUB.error_capture (
13868 1,
13869 'T',
13870 'F',
13871 null,
13872 x_rstatus,
13873 x_mcount,
13874 x_mdata,
13875 p_import_list_header_id,
13876 null, -- i_import_source_line_id,
13877 null,
13878 null,
13879 null,
13880 null,
13881 substr(x_mdata,1,2000));
13882 end if;
13883 end if;
13884 UPDATE ams_imp_list_headers_all
13885 set status_code = 'SCHEDULED',
13886 loaded_date = sysdate,
13887 status_date = sysdate
13888 where import_list_header_id = p_import_list_header_id;
13889 open c_total_records;
13890 fetch c_total_records into l_total_records;
13891 close c_total_records;
13892 AMS_Utility_PVT.Create_Log (
13893 x_return_status => l_return_status,
13894 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13895 p_log_used_by_id => p_import_list_header_id,
13896 p_msg_data => 'Total Number of records available for processing: '||to_char(l_total_records),
13897 p_msg_type => 'DEBUG'
13898 );
13899
13900 -- ****************************************************8
13901 if l_dedupe_flag = 'Y' then
13902 AMS_Utility_PVT.Create_Log (
13903 x_return_status => l_return_status,
13904 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13905 p_log_used_by_id => p_import_list_header_id,
13906 p_msg_data => 'Starting De-Duplicate check in the Marketing tables .',
13907 p_msg_type => 'DEBUG'
13908 );
13909
13910 dedup_check( p_import_list_header_id);
13911
13912 open c_dup_recs;
13913 fetch c_dup_recs into l_duplicate_records;
13914 close c_dup_recs;
13915 update ams_imp_list_headers_all
13916 set number_of_duplicate_records = l_duplicate_records
13917 where import_list_header_id = p_import_list_header_id;
13918
13919 AMS_Utility_PVT.Create_Log (
13920 x_return_status => l_return_status,
13921 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13922 p_log_used_by_id => p_import_list_header_id,
13923 p_msg_data => 'END De-Duplicate check in the Marketing tables .',
13924 p_msg_type => 'DEBUG'
13925 );
13926 end if;
13927 -- ****************************************************8
13928 AMS_Utility_PVT.Create_Log (
13929 x_return_status => l_return_status,
13930 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13931 p_log_used_by_id => p_import_list_header_id,
13932 p_msg_data => 'Start gen_transposed_phone_number.',
13933 p_msg_type => 'DEBUG'
13934 );
13935
13936 gen_transposed_phone_number( x_import_list_header_id, x_return_status,
13937 x_msg_count, x_msg_data );
13938 AMS_Utility_PVT.Create_Log (
13939 x_return_status => l_return_status,
13940 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
13941 p_log_used_by_id => p_import_list_header_id,
13942 p_msg_data => 'End gen_transposed_phone_number.',
13943 p_msg_type => 'DEBUG'
13944 );
13945
13946 if l_import_type = 'B2B' then
13947 --if party_id is provided and if its of type relationship
13948 --update org_party_id and ocont_party_id
13949 update ams_hz_b2b_mapping_v b2b
13950 set (org_party_id, ocont_party_id) = (select object_id, subject_id from hz_relationships
13951 where party_id = b2b.party_id and object_type = 'ORGANIZATION'
13952 and subject_type = 'PERSON' and relationship_type = 'CONTACT'
13953 and nvl(status,'A') = 'A')
13954 where import_list_header_id = p_import_list_header_id
13955 and party_id is not null
13956 and org_party_id is null;
13957
13958 --if party_id is of type organization then update org_party_id with party_id
13959 update ams_hz_b2b_mapping_v b2b
13960 set org_party_id = (select party_id from hz_parties where party_type = 'ORGANIZATION' and party_id = b2b.party_id and nvl(status,'A') = 'A') -- bug 5100612
13961 where import_list_header_id = p_import_list_header_id
13962 and party_id is not null
13963 and org_party_id is null;
13964
13965 update ams_hz_b2b_mapping_v
13966 set org_exist = 'Y'
13967 where import_list_header_id = p_import_list_header_id
13968 and org_party_id is not null;
13969
13970 update ams_hz_b2b_mapping_v
13971 set ocont_exist = 'Y'
13972 where import_list_header_id = p_import_list_header_id
13973 and ocont_party_id is not null;
13974
13975 elsif l_import_type = 'B2C' then
13976
13977 --aanjaria: bug 4913239: copy party_id to person_party_id so that existence check is by passed
13978 -- mayjain bug 5100612 this update should be done only if the party_id is a valid one.
13979 UPDATE ams_hz_b2c_mapping_v b2c
13980 SET person_party_id = (select party_id from hz_parties where party_type = 'PERSON' and party_id = b2c.party_id and nvl(status,'A') = 'A') -- bug 5100612,
13981 WHERE import_list_header_id = p_import_list_header_id
13982 AND party_id is not null
13983 AND person_party_id is null;
13984
13985 -- bug 5100612
13986 UPDATE ams_hz_b2c_mapping_v b2c
13987 SET person_exist = 'Y'
13988 WHERE import_list_header_id = p_import_list_header_id
13989 and person_party_id is not null;
13990 end if;
13991
13992 commit;
13993
13994 if x_hz_dup_check = 'Y' then
13995 if l_import_type = 'B2B' then
13996 if l_osr_mapped = 'Y' then
13997 AMS_Utility_PVT.Create_Log (
13998 x_return_status => l_return_status,
13999 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14000 p_log_used_by_id => p_import_list_header_id,
14001 p_msg_data => 'Start org_existence_checking_osr.',
14002 p_msg_type => 'DEBUG'
14003 );
14004 org_existence_checking_osr(x_import_list_header_id,
14005 x_return_status,x_msg_count,x_msg_data);
14006 AMS_Utility_PVT.Create_Log (
14007 x_return_status => l_return_status,
14008 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14009 p_log_used_by_id => p_import_list_header_id,
14010 p_msg_data => 'End org_existence_checking_osr.',
14011 p_msg_type => 'DEBUG'
14012 );
14013 end if;
14014 AMS_Utility_PVT.Create_Log (
14015 x_return_status => l_return_status,
14016 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14017 p_log_used_by_id => p_import_list_header_id,
14018 p_msg_data => 'Start org_existence_checking.',
14019 p_msg_type => 'DEBUG'
14020 );
14021 org_existence_checking(x_import_list_header_id,
14022 x_return_status,x_msg_count,x_msg_data);
14023 AMS_Utility_PVT.Create_Log (
14024 x_return_status => l_return_status,
14025 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14026 p_log_used_by_id => p_import_list_header_id,
14027 p_msg_data => 'End org_existence_checking.',
14028 p_msg_type => 'DEBUG'
14029 );
14030 if x_return_status <> 'S' then
14031 AMS_Utility_PVT.Create_Log (
14032 x_return_status => l_return_status,
14033 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14034 p_log_used_by_id => p_import_list_header_id,
14035 p_msg_data => 'Aborting org_existence_checking.',
14036 p_msg_type => 'DEBUG');
14037 l_lookup_code := 'ERROR';
14038 l_user_status_id := null;
14039 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14040 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14041 system_status_code = 'ERROR' and default_flag = 'Y';
14042
14043 UPDATE ams_imp_list_headers_all
14044 set status_code = l_lookup_code,
14045 user_status_id = l_user_status_id,
14046 status_date = sysdate
14047 where import_list_header_id = p_import_list_header_id;
14048 return;
14049 end if;
14050 if l_osr_mapped = 'Y' then
14051 AMS_Utility_PVT.Create_Log (
14052 x_return_status => l_return_status,
14053 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14054 p_log_used_by_id => p_import_list_header_id,
14055 p_msg_data => 'Start org_cont_existence_chk_osr.',
14056 p_msg_type => 'DEBUG'
14057 );
14058 org_cont_existence_chk_osr(x_import_list_header_id,
14059 x_return_status,x_msg_count,x_msg_data);
14060 AMS_Utility_PVT.Create_Log (
14061 x_return_status => l_return_status,
14062 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14063 p_log_used_by_id => p_import_list_header_id,
14064 p_msg_data => 'End org_cont_existence_chk_osr.',
14065 p_msg_type => 'DEBUG'
14066 );
14067 end if;
14068 AMS_Utility_PVT.Create_Log (
14069 x_return_status => l_return_status,
14070 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14071 p_log_used_by_id => p_import_list_header_id,
14072 p_msg_data => 'Start org_cont_existence_checking.',
14073 p_msg_type => 'DEBUG'
14074 );
14075 org_cont_existence_checking(x_import_list_header_id,
14076 x_return_status,x_msg_count,x_msg_data);
14077 AMS_Utility_PVT.Create_Log (
14078 x_return_status => l_return_status,
14079 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14080 p_log_used_by_id => p_import_list_header_id,
14081 p_msg_data => 'End org_cont_existence_checking.',
14082 p_msg_type => 'DEBUG'
14083 );
14084 if x_return_status <> 'S' then
14085 AMS_Utility_PVT.Create_Log (
14086 x_return_status => l_return_status,
14087 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14088 p_log_used_by_id => p_import_list_header_id,
14089 p_msg_data => 'Aborting org_cont_existence_checking.',
14090 p_msg_type => 'DEBUG');
14091 l_lookup_code := 'ERROR';
14092 l_user_status_id := null;
14093 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14094 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14095 system_status_code = 'ERROR' and default_flag = 'Y';
14096
14097 UPDATE ams_imp_list_headers_all
14098 set status_code = l_lookup_code,
14099 user_status_id = l_user_status_id,
14100 status_date = sysdate
14101 where import_list_header_id = p_import_list_header_id;
14102 return;
14103 end if;
14104 AMS_Utility_PVT.Create_Log (
14105 x_return_status => l_return_status,
14106 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14107 p_log_used_by_id => p_import_list_header_id,
14108 p_msg_data => 'Start org_address_existence_checking.',
14109 p_msg_type => 'DEBUG'
14110 );
14111 org_address_existence_checking(x_import_list_header_id,
14112 x_return_status,x_msg_count,x_msg_data);
14113 AMS_Utility_PVT.Create_Log (
14114 x_return_status => l_return_status,
14115 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14116 p_log_used_by_id => p_import_list_header_id,
14117 p_msg_data => 'End org_address_existence_checking.',
14118 p_msg_type => 'DEBUG'
14119 );
14120 if x_return_status <> 'S' then
14121 AMS_Utility_PVT.Create_Log (
14122 x_return_status => l_return_status,
14123 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14124 p_log_used_by_id => p_import_list_header_id,
14125 p_msg_data => 'Aborting org_address_existence_checking.',
14126 p_msg_type => 'DEBUG');
14127 l_lookup_code := 'ERROR';
14128 l_user_status_id := null;
14129 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14130 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14131 system_status_code = 'ERROR' and default_flag = 'Y';
14132
14133 UPDATE ams_imp_list_headers_all
14134 set status_code = l_lookup_code,
14135 user_status_id = l_user_status_id,
14136 status_date = sysdate
14137 where import_list_header_id = p_import_list_header_id;
14138 return;
14139 end if;
14140 AMS_Utility_PVT.Create_Log (
14141 x_return_status => l_return_status,
14142 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14143 p_log_used_by_id => p_import_list_header_id,
14144 p_msg_data => 'Start org_address1_exist_checking.',
14145 p_msg_type => 'DEBUG'
14146 );
14147 org_address1_exist_checking(x_import_list_header_id,
14148 x_return_status,x_msg_count,x_msg_data);
14149 AMS_Utility_PVT.Create_Log (
14150 x_return_status => l_return_status,
14151 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14152 p_log_used_by_id => p_import_list_header_id,
14153 p_msg_data => 'End org_address1_exist_checking.',
14154 p_msg_type => 'DEBUG'
14155 );
14156 if x_return_status <> 'S' then
14157 AMS_Utility_PVT.Create_Log (
14158 x_return_status => l_return_status,
14159 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14160 p_log_used_by_id => p_import_list_header_id,
14161 p_msg_data => 'Aborting org_address1_exist_checking.',
14162 p_msg_type => 'DEBUG');
14163 l_lookup_code := 'ERROR';
14164 l_user_status_id := null;
14165 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14166 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14167 system_status_code = 'ERROR' and default_flag = 'Y';
14168 UPDATE ams_imp_list_headers_all
14169 set status_code = l_lookup_code,
14170 user_status_id = l_user_status_id,
14171 status_date = sysdate
14172 where import_list_header_id = p_import_list_header_id;
14173 return;
14174 end if;
14175
14176 ELSE
14177
14178 if l_osr_mapped = 'Y' then
14179 AMS_Utility_PVT.Create_Log (
14180 x_return_status => l_return_status,
14181 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14182 p_log_used_by_id => p_import_list_header_id,
14183 p_msg_data => 'Start per_existence_checking.',
14184 p_msg_type => 'DEBUG'
14185 );
14186 per_existence_checking_osr(x_import_list_header_id,
14187 x_return_status,x_msg_count,x_msg_data);
14188 AMS_Utility_PVT.Create_Log (
14189 x_return_status => l_return_status,
14190 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14191 p_log_used_by_id => p_import_list_header_id,
14192 p_msg_data => 'End per_existence_checking.',
14193 p_msg_type => 'DEBUG'
14194 );
14195 end if;
14196 AMS_Utility_PVT.Create_Log (
14197 x_return_status => l_return_status,
14198 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14199 p_log_used_by_id => p_import_list_header_id,
14200 p_msg_data => 'Start per_existence_checking.',
14201 p_msg_type => 'DEBUG'
14202 );
14203 per_existence_checking(x_import_list_header_id,
14204 x_return_status,x_msg_count,x_msg_data);
14205 AMS_Utility_PVT.Create_Log (
14206 x_return_status => l_return_status,
14207 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14208 p_log_used_by_id => p_import_list_header_id,
14209 p_msg_data => 'End per_existence_checking.',
14210 p_msg_type => 'DEBUG'
14211 );
14212 if x_return_status <> 'S' then
14213 AMS_Utility_PVT.Create_Log (
14214 x_return_status => l_return_status,
14215 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14216 p_log_used_by_id => p_import_list_header_id,
14217 p_msg_data => 'Aborting per_existence_checking.',
14218 p_msg_type => 'DEBUG');
14219 l_lookup_code := 'ERROR';
14220 l_user_status_id := null;
14221 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14222 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14223 system_status_code = 'ERROR' and default_flag = 'Y';
14224
14225 UPDATE ams_imp_list_headers_all
14226 set status_code = l_lookup_code,
14227 user_status_id = l_user_status_id,
14228 status_date = sysdate
14229 where import_list_header_id = p_import_list_header_id;
14230 return;
14231 end if;
14232 AMS_Utility_PVT.Create_Log (
14233 x_return_status => l_return_status,
14234 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14235 p_log_used_by_id => p_import_list_header_id,
14236 p_msg_data => 'Start per_address_existence_checking.',
14237 p_msg_type => 'DEBUG'
14238 );
14239 per_address_existence_checking(x_import_list_header_id,
14240 x_return_status,x_msg_count,x_msg_data);
14241 AMS_Utility_PVT.Create_Log (
14242 x_return_status => l_return_status,
14243 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14244 p_log_used_by_id => p_import_list_header_id,
14245 p_msg_data => 'End per_address_existence_checking.',
14246 p_msg_type => 'DEBUG'
14247 );
14248 if x_return_status <> 'S' then
14249 AMS_Utility_PVT.Create_Log (
14250 x_return_status => l_return_status,
14251 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14252 p_log_used_by_id => p_import_list_header_id,
14253 p_msg_data => 'Aborting per_address_existence_checking.',
14254 p_msg_type => 'DEBUG');
14255 l_lookup_code := 'ERROR';
14256 l_user_status_id := null;
14257 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14258 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14259 system_status_code = 'ERROR' and default_flag = 'Y';
14260
14261 UPDATE ams_imp_list_headers_all
14262 set status_code = l_lookup_code,
14263 user_status_id = l_user_status_id,
14264 status_date = sysdate
14265 where import_list_header_id = p_import_list_header_id;
14266 return;
14267 end if;
14268
14269 end if;
14270 end if ; -- if x_hz_dup_check = 'Y' then
14271 -- >>>>>>>>>>>>>>>
14272
14273 -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14274 -- Call the Validate Process
14275 if l_validate_file = 'Y' then
14276 AMS_Utility_PVT.Create_Log (
14277 x_return_status => l_return_status,
14278 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14279 p_log_used_by_id => p_import_list_header_id,
14280 p_msg_data => 'Starting Validation for CUSTOMER data.',
14281 p_msg_type => 'DEBUG'
14282 );
14283 -- Delete all the errors from the errors table which are reloaded.
14284 delete from ams_list_import_errors where import_list_header_id
14285 = p_import_list_header_id and import_source_line_id = 0;
14286 delete from ams_list_import_errors where import_list_header_id
14287 = p_import_list_header_id and import_source_line_id in
14288 (select import_source_line_id from ams_imp_source_lines where
14289 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_RELOAD);
14290 if l_file_type = 'XML' then
14291 update_xml_error_text (
14292 p_import_list_header_id,
14293 l_import_type);
14294 end if;
14295 l_return_status := null;
14296 execute_cust_data_validation ( p_import_list_header_id, l_return_status);
14297 if l_return_status <> 'S' then
14298 AMS_Utility_PVT.Create_Log (
14299 x_return_status => l_return_status,
14300 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14301 p_log_used_by_id => p_import_list_header_id,
14302 p_msg_data => 'Customer import terminated because of error in Data validation process.',
14303 p_msg_type => 'DEBUG'
14304 );
14305
14306 l_lookup_code := 'ERROR';
14307 l_user_status_id := null;
14308 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14309 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14310 system_status_code = 'ERROR' and default_flag = 'Y';
14311
14312 UPDATE ams_imp_list_headers_all
14313 set status_code = l_lookup_code,
14314 user_status_id = l_user_status_id,
14315 status_date = sysdate
14316 where import_list_header_id = p_import_list_header_id;
14317 return;
14318 end if;
14319 -- ((((((((((((((((((((((((((((((((((((((((((((((
14320 if l_file_type = 'XML' then
14321 l_return_status := null;
14322 exe_custxml_data_validation ( p_import_list_header_id, l_return_status);
14323 if l_return_status <> 'S' then
14324 AMS_Utility_PVT.Create_Log (
14325 x_return_status => l_return_status,
14326 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14327 p_log_used_by_id => p_import_list_header_id,
14328 p_msg_data => 'Customer import terminated because of error in XML Data validation process.',
14329 p_msg_type => 'DEBUG'
14330 );
14331 l_lookup_code := 'ERROR';
14332 l_user_status_id := null;
14333 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14334 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14335 system_status_code = 'ERROR' and default_flag = 'Y';
14336
14337 UPDATE ams_imp_list_headers_all
14338 set status_code = l_lookup_code,
14339 user_status_id = l_user_status_id,
14340 status_date = sysdate
14341 where import_list_header_id = p_import_list_header_id;
14342 return;
14343 end if;
14344 end if;
14345 -- ((((((((((((((((((((((((((((((((((((((((((((((
14346
14347 AMS_Utility_PVT.Create_Log (
14348 x_return_status => l_return_status,
14349 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14350 p_log_used_by_id => p_import_list_header_id,
14351 p_msg_data => 'End Validation for CUSTOMER data.',
14352 p_msg_type => 'DEBUG'
14353 );
14354 end if;
14355
14356 AMS_Utility_PVT.Create_Log (
14357 x_return_status => l_return_status,
14358 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14359 p_log_used_by_id => p_import_list_header_id,
14360 p_msg_data => 'Starting client load for TCA.',
14361 p_msg_type => 'DEBUG'
14362 );
14363
14364 -- sranka 3/21/2003
14365 -- made changes for "EMPLOYEE_OF" support
14366 execute_reltnship_validation( p_import_list_header_id, l_return_status);
14367 l_total_records := 0;
14368 open c_total_records;
14369 fetch c_total_records into l_total_records;
14370 close c_total_records;
14371 if l_total_records = 0 then
14372 update_cust_import_status(p_import_list_header_id);
14373 return;
14374 end if;
14375
14376 -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..
14377 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
14378 application => 'AMS',
14379 program => 'AMSILHZC',
14380 argument1 => p_import_list_header_id,
14381 argument2 => l_numb_of_inst
14382 );
14383
14384 AMS_Utility_PVT.Create_Log (
14385 x_return_status => l_return_status,
14386 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14387 p_log_used_by_id => p_import_list_header_id,
14388 p_msg_data => 'Starting TCA program (AMSILHZC) -- concurrent program_id is '||to_char(l_request_id),
14389 p_msg_type => 'DEBUG');
14390
14391 IF l_request_id = 0 THEN
14392 AMS_Utility_PVT.Create_Log (
14393 x_return_status => l_return_status,
14394 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14395 p_log_used_by_id => p_import_list_header_id,
14396 p_msg_data => 'Error in (AMSILHZC) -- concurrent program_id is '||to_char(l_request_id),
14397 p_msg_type => 'DEBUG');
14398 l_mesg_text := fnd_message.get;
14399 AMS_Utility_PVT.Create_Log (
14400 x_return_status => l_return_status,
14401 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14402 p_log_used_by_id => p_import_list_header_id,
14403 p_msg_data => l_mesg_text,
14404 p_msg_type => 'DEBUG' );
14405
14406 l_user_status_id := null;
14407 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14408 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14409 system_status_code = 'ERROR' and default_flag = 'Y';
14410 UPDATE ams_imp_list_headers_all
14411 set status_code = l_lookup_code,
14412 user_status_id = l_user_status_id,
14413 status_date = sysdate
14414 where import_list_header_id = p_import_list_header_id;
14415 commit;
14416
14417 RAISE FND_API.g_exc_unexpected_error;
14418 end if;
14419
14420 -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..
14421 /*
14422 list_import_to_hz (
14423 l_msg_buf,
14424 l_msg_code,
14425 p_import_list_header_id
14426 );
14427 */
14428 AMS_Utility_PVT.Create_Log (
14429 x_return_status => l_return_status,
14430 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14431 p_log_used_by_id => p_import_list_header_id,
14432 p_msg_data => 'End client load for TCA.',
14433 p_msg_type => 'DEBUG'
14434 );
14435
14436 /*
14437 if l_msg_code = 2 then
14438 l_lookup_code := 'ERROR';
14439 l_user_status_id := null;
14440 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14441 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14442 system_status_code = 'ERROR' and default_flag = 'Y';
14443
14444 UPDATE ams_imp_list_headers_all
14445 set status_code = l_lookup_code,
14446 user_status_id = l_user_status_id,
14447 status_date = sysdate
14448 where import_list_header_id = p_import_list_header_id;
14449 end if;
14450 */
14451 end if; -- STAGED
14452 /*
14453 open c_error_exist;
14454 fetch c_error_exist into l_error_exist;
14455 close c_error_exist;
14456 if l_error_exist = 'Y' then
14457 l_lookup_code := 'ERROR';
14458 l_user_status_id := null;
14459 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14460 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14461 system_status_code = 'ERROR' and default_flag = 'Y';
14462
14463 UPDATE ams_imp_list_headers_all
14464 set status_code = l_lookup_code,
14465 user_status_id = l_user_status_id,
14466 status_date = sysdate
14467 where import_list_header_id = p_import_list_header_id;
14468 end if;
14469 if l_error_exist is NULL then
14470 l_lookup_code := 'COMPLETED';
14471 l_user_status_id := null;
14472 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14473 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14474 system_status_code = 'COMPLETED' and default_flag = 'Y';
14475
14476 UPDATE ams_imp_list_headers_all
14477 set status_code = l_lookup_code,
14478 user_status_id = l_user_status_id,
14479 status_date = sysdate
14480 where import_list_header_id = p_import_list_header_id;
14481 end if;
14482
14483 -- Delete all the errors from the errors table which are sucessful.
14484 delete from ams_list_import_errors where import_list_header_id
14485 = p_import_list_header_id and import_source_line_id in
14486 (select import_source_line_id from ams_imp_source_lines where
14487 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_SUCCESS);
14488 open c_loaded_records;
14489 fetch c_loaded_records into l_loaded_records;
14490 close c_loaded_records;
14491 open c_failed_records;
14492 fetch c_failed_records into l_failed_records;
14493 close c_failed_records;
14494 UPDATE ams_imp_list_headers_all
14495 SET loaded_no_of_rows = l_loaded_records,
14496 number_of_failed_records = l_failed_records,
14497 loaded_date = sysdate
14498 WHERE import_list_header_id = p_import_list_header_id;
14499 */
14500 end if; -- CUSTOMER
14501 /*
14502 if p_generate_list = 'Y' then
14503 AMS_Utility_PVT.Create_Log (
14504 x_return_status => l_return_status,
14505 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14506 p_log_used_by_id => p_import_list_header_id,
14507 p_msg_data => 'Starting List Generation for List Import.',
14508 p_msg_type => 'DEBUG'
14509 );
14510
14511 l_loaded_rows := 0;
14512 select LOADED_NO_OF_ROWS into l_loaded_rows from ams_imp_list_headers_all
14513 where import_list_header_id = p_import_list_header_id;
14514
14515 if l_loaded_rows > 0 then
14516
14517 AMS_ListGeneration_PKG.create_import_list
14518 ( 1,
14519 'T',
14520 'T',
14521 FND_API.G_VALID_LEVEL_FULL,
14522 p_owner_user_id,
14523 p_import_list_header_id,
14524 i_return_status,
14525 i_msg_count,
14526 i_msg_data,
14527 l_list_header_id,
14528 p_list_name) ;
14529
14530 If i_return_status <> 'S' then
14531 AMS_Utility_PVT.Create_Log (
14532 x_return_status => l_return_status,
14533 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14534 p_log_used_by_id => p_import_list_header_id,
14535 p_msg_data => 'Error in List Generation --'||i_msg_data,
14536 p_msg_type => 'DEBUG'
14537 );
14538 End if;
14539 end if;
14540 AMS_Utility_PVT.Create_Log (
14541 x_return_status => l_return_status,
14542 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14543 p_log_used_by_id => p_import_list_header_id,
14544 p_msg_data => 'End List Generation for List Import.',
14545 p_msg_type => 'DEBUG'
14546 );
14547 end if; -- p_generate_list
14548
14549 */
14550 -- STARTING CLIENT SIDE LEAD IMPORT --------------
14551 --
14552 --
14553
14554 if l_import_type = 'LEAD' then
14555 if l_status_code = 'STAGED' then
14556 UPDATE ams_imp_list_headers_all
14557 set status_code = 'SCHEDULED',
14558 loaded_date = sysdate,
14559 status_date = sysdate
14560 where import_list_header_id = p_import_list_header_id;
14561 execute_lead_import ( p_import_list_header_id);
14562 /*
14563 l_request_id := FND_REQUEST.SUBMIT_REQUEST (
14564 application => 'AMS',
14565 program => 'AMSILLDC',
14566 argument1 => p_import_list_header_id
14567 );
14568 AMS_Utility_PVT.Create_Log (
14569 x_return_status => l_return_status,
14570 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14571 p_log_used_by_id => p_import_list_header_id,
14572 p_msg_data => 'Starting LEAD data upload program (AMSILLDC) -- concurrent program_id is '||to_char(l_request_id),
14573 p_msg_type => 'DEBUG'
14574 );
14575 commit;
14576 IF l_request_id = 0 THEN
14577 RAISE FND_API.g_exc_unexpected_error;
14578 end if;
14579 */
14580 end if;
14581 end if;
14582
14583 -- STARTING CLIENT SIDE EVENT IMPORT --------------
14584 --
14585 --
14586
14587 if l_import_type = 'EVENT' then
14588 if l_status_code = 'STAGED' then
14589 UPDATE ams_imp_list_headers_all
14590 set status_code = 'SCHEDULED',
14591 loaded_date = sysdate,
14592 status_date = sysdate
14593 where import_list_header_id = p_import_list_header_id;
14594
14595 -- Call the Validate Process
14596 if l_validate_file = 'Y' then
14597 AMS_Utility_PVT.Create_Log (
14598 x_return_status => l_return_status,
14599 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14600 p_log_used_by_id => p_import_list_header_id,
14601 p_msg_data => 'Starting Validation for EVENT data.',
14602 p_msg_type => 'DEBUG'
14603 );
14604 -- Delete all the errors from the errors table which are reloaded.
14605 delete from ams_list_import_errors where import_list_header_id
14606 = p_import_list_header_id and import_source_line_id = 0;
14607 delete from ams_list_import_errors where import_list_header_id
14608 = p_import_list_header_id and import_source_line_id in
14609 (select import_source_line_id from ams_imp_source_lines where
14610 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_RELOAD);
14611
14612 l_return_status := null;
14613 execute_event_data_validation ( p_import_list_header_id, l_return_status);
14614 if l_return_status <> 'S' then
14615 AMS_Utility_PVT.Create_Log (
14616 x_return_status => l_return_status,
14617 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14618 p_log_used_by_id => p_import_list_header_id,
14619 p_msg_data => 'EVENT import terminated because of error in Data validation process.',
14620 p_msg_type => 'DEBUG'
14621 );
14622
14623 l_lookup_code := 'ERROR';
14624 l_user_status_id := null;
14625 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14626 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14627 system_status_code = 'ERROR' and default_flag = 'Y';
14628
14629 UPDATE ams_imp_list_headers_all
14630 set status_code = l_lookup_code,
14631 user_status_id = l_user_status_id,
14632 status_date = sysdate
14633 where import_list_header_id = p_import_list_header_id;
14634 return;
14635 end if;
14636
14637 AMS_Utility_PVT.Create_Log (
14638 x_return_status => l_return_status,
14639 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14640 p_log_used_by_id => p_import_list_header_id,
14641 p_msg_data => 'End Validation for Event data.',
14642 p_msg_type => 'DEBUG'
14643 );
14644 end if;
14645
14646 AMS_Utility_PVT.Create_Log (
14647 x_return_status => l_return_status,
14648 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14649 p_log_used_by_id => p_import_list_header_id,
14650 p_msg_data => 'Starting client load for EVENT.',
14651 p_msg_type => 'DEBUG'
14652 );
14653 ams_imp_reg_detail_pvt.LoadProcess(
14654 l_msg_buf,
14655 l_msg_code,
14656 p_import_list_header_id
14657 );
14658 AMS_Utility_PVT.Create_Log (
14659 x_return_status => l_return_status,
14660 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14661 p_log_used_by_id => p_import_list_header_id,
14662 p_msg_data => 'End client load for EVENT.',
14663 p_msg_type => 'DEBUG'
14664 );
14665
14666 open c_error_exist;
14667 fetch c_error_exist into l_error_exist;
14668 close c_error_exist;
14669 if l_error_exist = 'Y' then
14670 l_lookup_code := 'ERROR';
14671 l_user_status_id := null;
14672 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14673 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14674 system_status_code = 'ERROR' and default_flag = 'Y';
14675
14676 UPDATE ams_imp_list_headers_all
14677 set status_code = l_lookup_code,
14678 user_status_id = l_user_status_id,
14679 status_date = sysdate
14680 where import_list_header_id = p_import_list_header_id;
14681 end if;
14682 if l_error_exist is NULL then
14683 l_lookup_code := 'COMPLETED';
14684 l_user_status_id := null;
14685 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
14686 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
14687 system_status_code = 'COMPLETED' and default_flag = 'Y';
14688
14689 UPDATE ams_imp_list_headers_all
14690 set status_code = l_lookup_code,
14691 user_status_id = l_user_status_id,
14692 status_date = sysdate
14693 where import_list_header_id = p_import_list_header_id;
14694 end if;
14695 -- Delete all the errors from the errors table which are sucessful.
14696 delete from ams_list_import_errors where import_list_header_id
14697 = p_import_list_header_id and import_source_line_id in
14698 (select import_source_line_id from ams_imp_source_lines where
14699 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_SUCCESS);
14700 open c_loaded_records;
14701 fetch c_loaded_records into l_loaded_records;
14702 close c_loaded_records;
14703 open c_failed_records;
14704 fetch c_failed_records into l_failed_records;
14705 close c_failed_records;
14706
14707 UPDATE ams_imp_list_headers_all
14708 SET loaded_no_of_rows = l_loaded_records,
14709 number_of_failed_records = l_failed_records,
14710 loaded_date = sysdate
14711 where import_list_header_id = p_import_list_header_id;
14712 -- end if;
14713 end if;
14714 end if;
14715
14716
14717
14718 if (l_import_type = 'EVENT' or l_import_type = 'LEAD')then
14719
14720 l_total_records := 0;
14721 open c_total_records;
14722 fetch c_total_records into l_total_records;
14723 close c_total_records;
14724 AMS_Utility_PVT.Create_Log (
14725 x_return_status => l_return_status,
14726 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14727 p_log_used_by_id => p_import_list_header_id,
14728 p_msg_data => 'Total Number of records not processed: '||to_char(l_total_records),
14729 p_msg_type => 'DEBUG'
14730 );
14731 END IF;
14732
14733 -- **********************************************************
14734
14735 EXCEPTION
14736 WHEN others THEN
14737 AMS_Utility_PVT.Create_Log (
14738 x_return_status => l_return_status,
14739 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14740 p_log_used_by_id => p_import_list_header_id,
14741 p_msg_data => sqlerrm ,
14742 p_msg_type => 'DEBUG'
14743 );
14744 raise;
14745 end client_load_direct ;
14746
14747
14748 -- -------------------------------------------
14749 PROCEDURE client_load_cm (
14750 Errbuf OUT NOCOPY VARCHAR2,
14751 Retcode OUT NOCOPY VARCHAR2,
14752 p_import_list_header_id IN NUMBER,
14753 p_owner_user_id IN NUMBER,
14754 p_generate_list IN VARCHAR2 , -- Used for staged table import.
14755 p_list_name IN VARCHAR2 -- For list generation name.
14756 ) IS
14757 l_return_status varchar2(1);
14758 BEGIN
14759 client_load_direct (
14760 p_import_list_header_id ,
14761 p_owner_user_id,
14762 p_generate_list,
14763 p_list_name );
14764 EXCEPTION
14765 WHEN others THEN
14766 AMS_Utility_PVT.Create_Log (
14767 x_return_status => l_return_status,
14768 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
14769 p_log_used_by_id => p_import_list_header_id,
14770 p_msg_data => sqlerrm ,
14771 p_msg_type => 'DEBUG'
14772 );
14773 raise;
14774
14775 end client_load_cm;
14776
14777
14778 -- -------------------------------------------------------------
14779
14780 -- This program performs error checks errors for event import.
14781
14782 PROCEDURE execute_event_data_validation (
14783 p_import_list_header_id NUMBER,
14784 p_return_status OUT NOCOPY VARCHAR2
14785 ) IS
14786
14787 TYPE num_data_set_type_w IS
14788 TABLE OF NUMBER INDEX BY BINARY_INTEGER;
14789
14790 TYPE varchar2_250_set_type IS
14791 TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
14792
14793 L_MAX_ROW_COUNT CONSTANT NUMBER := 1000;
14794 l_batch_id NUMBER;
14795 x_import_list_header_id number;
14796 x_import_source_line_id number;
14797 l_message varchar2(100);
14798 l_invalid_number varchar2(4000) ;
14799 l_invalid_size varchar2(4000) ;
14800 l_null_value varchar2(4000) ;
14801 l_invalid_src_system varchar2(4000) ;
14802 l_return_status varchar2(1);
14803 l_total_rec number;
14804 l_source_system varchar2(60);
14805 l_error_exists varchar2(1);
14806
14807
14808
14809 l_import_source_line_id num_data_set_type_w;
14810 l_import_list_header_id num_data_set_type_w;
14811
14812 l_col1 varchar2_250_set_type;
14813 l_col2 varchar2_250_set_type;
14814 l_col3 varchar2_250_set_type;
14815 l_col4 varchar2_250_set_type;
14816 l_col5 varchar2_250_set_type;
14817 l_col6 varchar2_250_set_type;
14818 l_col7 varchar2_250_set_type;
14819 l_col8 varchar2_250_set_type;
14820 l_col9 varchar2_250_set_type;
14821 l_col10 varchar2_250_set_type;
14822 l_col11 varchar2_250_set_type;
14823 l_col12 varchar2_250_set_type;
14824 l_col13 varchar2_250_set_type;
14825 l_col14 varchar2_250_set_type;
14826 l_col15 varchar2_250_set_type;
14827 l_col16 varchar2_250_set_type;
14828 l_col17 varchar2_250_set_type;
14829 l_col18 varchar2_250_set_type;
14830 l_col19 varchar2_250_set_type;
14831 l_col20 varchar2_250_set_type;
14832 l_col21 varchar2_250_set_type;
14833 l_col22 varchar2_250_set_type;
14834 l_col23 varchar2_250_set_type;
14835 l_col24 varchar2_250_set_type;
14836 l_col25 varchar2_250_set_type;
14837 l_col26 varchar2_250_set_type;
14838 l_col27 varchar2_250_set_type;
14839 l_col28 varchar2_250_set_type;
14840 l_col29 varchar2_250_set_type;
14841 l_col30 varchar2_250_set_type;
14842 l_col31 varchar2_250_set_type;
14843 l_col32 varchar2_250_set_type;
14844 l_col33 varchar2_250_set_type;
14845 l_col34 varchar2_250_set_type;
14846 l_col35 varchar2_250_set_type;
14847 l_col36 varchar2_250_set_type;
14848 l_col37 varchar2_250_set_type;
14849 l_col38 varchar2_250_set_type;
14850 l_col39 varchar2_250_set_type;
14851 l_col40 varchar2_250_set_type;
14852 l_col41 varchar2_250_set_type;
14853 l_col42 varchar2_250_set_type;
14854 l_col43 varchar2_250_set_type;
14855 l_col44 varchar2_250_set_type;
14856 l_col45 varchar2_250_set_type;
14857 l_col46 varchar2_250_set_type;
14858 l_col47 varchar2_250_set_type;
14859 l_col48 varchar2_250_set_type;
14860 l_col49 varchar2_250_set_type;
14861 l_col50 varchar2_250_set_type;
14862 l_col51 varchar2_250_set_type;
14863 l_col52 varchar2_250_set_type;
14864 l_col53 varchar2_250_set_type;
14865 l_col54 varchar2_250_set_type;
14866 l_col55 varchar2_250_set_type;
14867 l_col56 varchar2_250_set_type;
14868 l_col57 varchar2_250_set_type;
14869 l_col58 varchar2_250_set_type;
14870 l_col59 varchar2_250_set_type;
14871 l_col60 varchar2_250_set_type;
14872 l_col61 varchar2_250_set_type;
14873 l_col62 varchar2_250_set_type;
14874 l_col63 varchar2_250_set_type;
14875 l_col64 varchar2_250_set_type;
14876 l_col65 varchar2_250_set_type;
14877 l_col66 varchar2_250_set_type;
14878 l_col67 varchar2_250_set_type;
14879 l_col68 varchar2_250_set_type;
14880 l_col69 varchar2_250_set_type;
14881 l_col70 varchar2_250_set_type;
14882 l_col71 varchar2_250_set_type;
14883 l_col72 varchar2_250_set_type;
14884 l_col73 varchar2_250_set_type;
14885 l_col74 varchar2_250_set_type;
14886 l_col75 varchar2_250_set_type;
14887 l_col76 varchar2_250_set_type;
14888 l_col77 varchar2_250_set_type;
14889 l_col78 varchar2_250_set_type;
14890 l_col79 varchar2_250_set_type;
14891 l_col80 varchar2_250_set_type;
14892 l_col81 varchar2_250_set_type;
14893 l_col82 varchar2_250_set_type;
14894 l_col83 varchar2_250_set_type;
14895 l_col84 varchar2_250_set_type;
14896 l_col85 varchar2_250_set_type;
14897 l_col86 varchar2_250_set_type;
14898 l_col87 varchar2_250_set_type;
14899 l_col88 varchar2_250_set_type;
14900 l_col89 varchar2_250_set_type;
14901 l_col90 varchar2_250_set_type;
14902 l_col91 varchar2_250_set_type;
14903 l_col92 varchar2_250_set_type;
14904 l_col93 varchar2_250_set_type;
14905 l_col94 varchar2_250_set_type;
14906 l_col95 varchar2_250_set_type;
14907 l_col96 varchar2_250_set_type;
14908 l_col97 varchar2_250_set_type;
14909 l_col98 varchar2_250_set_type;
14910 l_col99 varchar2_250_set_type;
14911 l_col100 varchar2_250_set_type;
14912 l_col101 varchar2_250_set_type;
14913 l_col102 varchar2_250_set_type;
14914 l_col103 varchar2_250_set_type;
14915 l_col104 varchar2_250_set_type;
14916 l_col105 varchar2_250_set_type;
14917 l_col106 varchar2_250_set_type;
14918 l_col107 varchar2_250_set_type;
14919 l_col108 varchar2_250_set_type;
14920 l_col109 varchar2_250_set_type;
14921 l_col110 varchar2_250_set_type;
14922 l_col111 varchar2_250_set_type;
14923 l_col112 varchar2_250_set_type;
14924 l_col113 varchar2_250_set_type;
14925 l_col114 varchar2_250_set_type;
14926 l_col115 varchar2_250_set_type;
14927 l_col116 varchar2_250_set_type;
14928 l_col117 varchar2_250_set_type;
14929 l_col118 varchar2_250_set_type;
14930 l_col119 varchar2_250_set_type;
14931 l_col120 varchar2_250_set_type;
14932 l_col121 varchar2_250_set_type;
14933 l_col122 varchar2_250_set_type;
14934 l_col123 varchar2_250_set_type;
14935 l_col124 varchar2_250_set_type;
14936 l_col125 varchar2_250_set_type;
14937 l_col126 varchar2_250_set_type;
14938 l_col127 varchar2_250_set_type;
14939 l_col128 varchar2_250_set_type;
14940 l_col129 varchar2_250_set_type;
14941 l_col130 varchar2_250_set_type;
14942 l_col131 varchar2_250_set_type;
14943 l_col132 varchar2_250_set_type;
14944 l_col133 varchar2_250_set_type;
14945 l_col134 varchar2_250_set_type;
14946 l_col135 varchar2_250_set_type;
14947
14948 CURSOR c_event_fields is
14949 SELECT
14950 import_source_line_id,
14951 import_list_header_id,
14952 DECODE(GREATEST(lengthb(LTRIM(RTRIM(EVENT_SOURCE_CODE))),100) - 100,0,' ','EVENT_SOURCE_CODE:'||decode(nvl(EVENT_SOURCE_CODE,'x'),'x',l_null_value,l_invalid_size)||'(100)') EVENT_SOURCE_CODE,
14953 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REGISTRATION_SOURCE_TYPE)),'x')),30) - 30,0,' ','REGISTRATION_SOURCE_TYPE:'||l_invalid_size||'(30)') REGISTRATION_SOURCE_TYPE,
14954 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PARTY_NAME)),'x')),360) - 360,0,' ','REG_PARTY_NAME:'||l_invalid_size||'(360)') REG_PARTY_NAME,
14955 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SIC_CODE)),'x')),30) - 30,0,' ','REG_SIC_CODE:'||l_invalid_size||'(30)') REG_SIC_CODE,
14956 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SIC_CODE)),'x')),30) - 30,0,' ','ATT_SIC_CODE:'||l_invalid_size||'(30)') ATT_SIC_CODE,
14957 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ANALYSIS_FY)),'x')),5) - 5,0,' ','REG_ANALYSIS_FY:'||l_invalid_size||'(5)') REG_ANALYSIS_FY,
14958 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ANALYSIS_FY)),'x')),5) - 5,0,' ','ATT_ANALYSIS_FY:'||l_invalid_size||'(5)') ATT_ANALYSIS_FY,
14959 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CATEGORY_CODE)),'x')),30) -30,0,' ','REG_CATEGORY_CODE:'||l_invalid_size||'(30)') REG_CATEGORY_CODE,
14960 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CATEGORY_CODE)),'x')),30) -30,0,' ','ATT_CATEGORY_CODE:'||l_invalid_size||'(30)') ATT_CATEGORY_CODE,
14961 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_TAX_REFERENCE)),'x')),50) - 50,0,' ','REG_TAX_REFERENCE:'||l_invalid_size||'(50)') REG_TAX_REFERENCE,
14962 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_TAX_REFERENCE)),'x')),50) - 50,0,' ','ATT_TAX_REFERENCE:'||l_invalid_size||'(50)') ATT_TAX_REFERENCE,
14963 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_YEAR_ESTABLISED,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_YEAR_ESTABLISED:'||l_invalid_number) ATT_YEAR_ESTABLISED,
14964 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_URL)),'x')),2000) - 2000,0,' ','REG_URL:'||l_invalid_size) REG_URL,
14965 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_URL)),'x')),2000) - 2000,0,' ','ATT_URL:'||l_invalid_size) ATT_URL,
14966 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_COUNTRY)),'x')),60) - 60,0,' ','REG_COUNTRY:'||l_invalid_size||'(60)') REG_COUNTRY,
14967 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_COUNTRY)),'x')),60) - 60,0,' ','ATT_COUNTRY:'||l_invalid_size||'(60)') ATT_COUNTRY,
14968 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS1)),'x')),240) - 240,0,' ','REG_ADDRESS1:'||l_invalid_size||'(240)') REG_ADDRESS1,
14969 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS2)),'x')),240) - 240,0,' ','REG_ADDRESS2:'||l_invalid_size||'(240)') REG_ADDRESS2,
14970 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS3)),'x')),240) - 240,0,' ','REG_ADDRESS3:'||l_invalid_size||'(240)') REG_ADDRESS3,
14971 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS4)),'x')),240) - 240,0,' ','REG_ADDRESS4:'||l_invalid_size||'(240)') REG_ADDRESS4,
14972 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CITY)),'x')),60) - 60,0,' ','REG_CITY:'||l_invalid_size||'(60)') REG_CITY,
14973 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_POSTAL_CODE)),'x')),60) - 60,0,' ','REG_POSTAL_CODE:'||l_invalid_size||'(60)') REG_POSTAL_CODE,
14974 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STATE)),'x')),60) - 60,0,' ','REG_STATE:'||l_invalid_size||'(60)') REG_STATE,
14975 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PROVINCE)),'x')),60) - 60,0,' ','REG_PROVINCE:'||l_invalid_size||'(60)') REG_PROVINCE,
14976 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_COUNTY)),'x')),60) - 60,0,' ','REG_COUNTY:'||l_invalid_size||'(60)') REG_COUNTY,
14977 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS1)),'x')),240) - 240,0,' ','ATT_ADDRESS1:'||l_invalid_size||'(240)') ATT_ADDRESS1,
14978 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS2)),'x')),240) - 240,0,' ','ATT_ADDRESS2:'||l_invalid_size||'(240)') ATT_ADDRESS2,
14979 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS3)),'x')),240) - 240,0,' ','ATT_ADDRESS3:'||l_invalid_size||'(240)') ATT_ADDRESS3,
14980 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS4)),'x')),240) - 240,0,' ','ATT_ADDRESS4:'||l_invalid_size||'(240)') ATT_ADDRESS4,
14981 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CITY)),'x')),60) - 60,0,' ','ATT_CITY:'||l_invalid_size||'(60)') ATT_CITY,
14982 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_POSTAL_CODE)),'x')),60) - 60,0,' ','ATT_POSTAL_CODE:'||l_invalid_size||'(60)') ATT_POSTAL_CODE,
14983 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STATE)),'x')),60) - 60,0,' ','ATT_STATE:'||l_invalid_size||'(60)') ATT_STATE,
14984 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PROVINCE)),'x')),60) - 60,0,' ','ATT_PROVINCE:'||l_invalid_size||'(60)') ATT_PROVINCE,
14985 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_COUNTY)),'x')),60) - 60,0,' ','ATT_COUNTY:'||l_invalid_size||'(60)') ATT_COUNTY,
14986 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_EMAIL_ADDRESS)),'x')),240) - 240,0,' ','REG_EMAIL_ADDRESS:'||l_invalid_size||'(240)') REG_EMAIL_ADDRESS,
14987 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_EMAIL_ADDRESS)),'x')),240) - 240,0,' ','ATT_EMAIL_ADDRESS:'||l_invalid_size||'(240)') ATT_EMAIL_ADDRESS,
14988 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_GENDER)),'x')),30) - 30,0,' ','REG_GENDER:'||l_invalid_size||'(30)') REG_GENDER,
14989 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_GENDER)),'x')),30) - 30,0,' ','ATT_GENDER:'||l_invalid_size||'(30)') ATT_GENDER,
14990 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_LAST_NAME)),'x')),50) - 50,0,' ','REG_LAST_NAME:'||l_invalid_size||'(50)') REG_LAST_NAME,
14991 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_FIRST_NAME)),'x')),40) - 40,0,' ','REG_FIRST_NAME:'||l_invalid_size||'(40)') REG_FIRST_NAME,
14992 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_LAST_NAME)),'x')),50) - 50,0,' ','ATT_LAST_NAME:'||l_invalid_size||'(50)') ATT_LAST_NAME,
14993 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_FIRST_NAME)),'x')),40) - 40,0,' ','ATT_FIRST_NAME:'||l_invalid_size||'(40)') ATT_FIRST_NAME,
14994 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_TITLE)),'x')),30) - 30,0,' ','REG_TITLE:'||l_invalid_size||'(30)') REG_TITLE,
14995 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_TITLE)),'x')),30) - 30,0,' ','ATT_TITLE:'||l_invalid_size||'(30)') ATT_TITLE,
14996 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_JOB_TITLE)),'x')),100) - 100,0,' ','REG_JOB_TITLE:'||l_invalid_size||'(100)') REG_JOB_TITLE,
14997 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_JOB_TITLE)),'x')),100) - 100,0,' ','ATT_JOB_TITLE:'||l_invalid_size||'(100)') ATT_JOB_TITLE,
14998 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_NUMBER)),'x')),25) - 25,0,' ','REG_PHONE_NUMBER:'||l_invalid_size||'(25)') REG_PHONE_NUMBER,
14999 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_AREA_CODE)),'x')),10) - 10,0,' ','REG_PHONE_AREA_CODE:'||l_invalid_size||'(10)') REG_PHONE_AREA_CODE,
15000 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_COUNTRY_CODE)),'x')),10) - 10,0,' ','REG_PHONE_COUNTRY_CODE:'||l_invalid_size||'(10)') REG_PHONE_COUNTRY_CODE,
15001 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_EXTENSION)),'x')),20) - 20,0,' ','REG_PHONE_EXTENSION:'||l_invalid_size||'(20)') REG_PHONE_EXTENSION,
15002 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_NUMBER)),'x')),25) - 25,0,' ','ATT_PHONE_NUMBER:'||l_invalid_size||'(25)') ATT_PHONE_NUMBER,
15003 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_AREA_CODE)),'x')),10) - 10,0,' ','ATT_PHONE_AREA_CODE:'||l_invalid_size||'(10)') ATT_PHONE_AREA_CODE,
15004 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_COUNTRY_CODE)),'x')),10) - 10,0,' ','ATT_PHONE_COUNTRY_CODE:'||l_invalid_size||'(10)') ATT_PHONE_COUNTRY_CODE,
15005 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_EXTENSION)),'x')),20) - 20,0,' ','ATT_PHONE_EXTENSION:'||l_invalid_size||'(20)') ATT_PHONE_EXTENSION,
15006 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_MIDDLE_NAME)),'x')),60) - 60,0,' ','REG_MIDDLE_NAME:'||l_invalid_size||'(10)') REG_MIDDLE_NAME,
15007 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_MIDDLE_NAME)),'x')),60) - 60,0,' ','ATT_MIDDLE_NAME:'||l_invalid_size||'(10)') ATT_MIDDLE_NAME,
15008 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATTENDANCE_FLAG)),'x')),1) - 1,0,' ','ATTENDANCE_FLAG:'||l_invalid_size||'(1)') ATTENDANCE_FLAG,
15009 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CANCELLATION_FLAG)),'x')),1) - 1,0,' ','CANCELLATION_FLAG:'||l_invalid_size||'(1)') CANCELLATION_FLAG,
15010 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_DECISION_MAKER_FLAG)),'x')),1) - 1,0,' ','REG_DECISION_MAKER_FLAG:'||l_invalid_size||'(1)') REG_DECISION_MAKER_FLAG,
15011 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_GSA_INDICATOR_FLAG)),'x')),30) - 30,0,' ','REG_GSA_INDICATOR_FLAG:'||l_invalid_size||'(30)') REG_GSA_INDICATOR_FLAG,
15012 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_GSA_INDICATOR_FLAG)),'x')),30) - 30,0,' ','ATT_GSA_INDICATOR_FLAG:'||l_invalid_size||'(30)') ATT_GSA_INDICATOR_FLAG,
15013 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_IDENTIFYING_ADDRESS_FLAG)),'x')),1) - 1,0,' ','REG_IDENTIFYING_ADDRESS_FLAG:'||l_invalid_size||'(1)') REG_IDENTIFYING_ADDRESS_FLAG,
15014 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_IDENTIFYING_ADDRESS_FLAG)),'x')),1) - 1,0,' ','ATT_IDENTIFYING_ADDRESS_FLAG:'||l_invalid_size||'(1)') ATT_IDENTIFYING_ADDRESS_FLAG,
15015 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CONTACT_ME_FLAG)),'x')),1) - 1,0,' ','REG_CONTACT_ME_FLAG:'||l_invalid_size||'(1)') REG_CONTACT_ME_FLAG,
15016 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_EMAIL_OK_FLAG)),'x')),1) - 1,0,' ','REG_EMAIL_OK_FLAG:'||l_invalid_size||'(1)') REG_EMAIL_OK_FLAG,
15017 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_APT_FLAG)),'x')),1) - 1,0,' ','ATT_APT_FLAG:'||l_invalid_size||'(1)') ATT_APT_FLAG,
15018 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_DECISION_MAKER_FLAG)),'x')),1) - 1,0,' ','ATT_DECISION_MAKER_FLAG:'||l_invalid_size||'(1)') ATT_DECISION_MAKER_FLAG,
15019 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CONTACT_ME_FLAG)),'x')),1) - 1,0,' ','ATT_CONTACT_ME_FLAG:'||l_invalid_size||'(1)') ATT_CONTACT_ME_FLAG,
15020 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_EMAIL_OK_FLAG)),'x')),1) - 1,0,' ','ATT_EMAIL_OK_FLAG:'||l_invalid_size||'(1)') ATT_EMAIL_OK_FLAG,
15021 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CANCELLATION_REASON_CODE)),'x')),30) - 30,0,' ','CANCELLATION_REASON_CODE:'||l_invalid_size||'(30)') CANCELLATION_REASON_CODE,
15022 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONFIRMATION_CODE)),'x')),30) - 30,0,' ','CONFIRMATION_CODE:'||l_invalid_size||'(30)') CONFIRMATION_CODE,
15023 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PARTY_TYPE)),'x')),30) - 30,0,' ','REG_PARTY_TYPE:'||l_invalid_size||'(30)') REG_PARTY_TYPE,
15024 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PARTY_TYPE)),'x')),30) - 30,0,' ','ATT_PARTY_TYPE:'||l_invalid_size||'(30)') ATT_PARTY_TYPE,
15025 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIGINAL_SYSTEM_REFERENCE)),'x')),240) - 240,0,' ','ORIGINAL_SYSTEM_REFERENCE:'||l_invalid_size||'(3)') ORIGINAL_SYSTEM_REFERENCE,
15026 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PARTY_NAME)),'x')),360) - 360,0,' ','ATT_PARTY_NAME:'||l_invalid_size||'(360)') ATT_PARTY_NAME,
15027 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_PARTY_ID:'||l_invalid_number) REG_PARTY_ID,
15028 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_PARTY_ID:'||l_invalid_number) ATT_PARTY_ID,
15029 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_CONTACT_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_CONTACT_ID:'||l_invalid_number) REG_CONTACT_ID,
15030 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_CONTACT_ID,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_CONTACT_ID:'||l_invalid_number) ATT_CONTACT_ID,
15031 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_CURRENT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_CURRENT_FY_POTENTIAL_REV:'||l_invalid_number) REG_CURRENT_FY_POTENTIAL_REV,
15032 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_CURRENT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_CURRENT_FY_POTENTIAL_REV:'||l_invalid_number) ATT_CURRENT_FY_POTENTIAL_REV,
15033 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_NEXT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_NEXT_FY_POTENTIAL_REV:'||l_invalid_number) REG_NEXT_FY_POTENTIAL_REV,
15034 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_NEXT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_NEXT_FY_POTENTIAL_REV:'||l_invalid_number) ATT_NEXT_FY_POTENTIAL_REV,
15035 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_HOUSEHOLD_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_HOUSEHOLD_INCOME:'||l_invalid_number) REG_HOUSEHOLD_INCOME,
15036 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_HOUSEHOLD_INCOME,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_HOUSEHOLD_INCOME:'||l_invalid_number) ATT_HOUSEHOLD_INCOME,
15037 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_EMPLOYEE_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_EMPLOYEE_TOTAL:'||l_invalid_number) REG_EMPLOYEE_TOTAL,
15038 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_HOUSE_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_HOUSE_NUMBER:'||l_invalid_number) REG_HOUSE_NUMBER,
15039 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_YEAR_ESTABLISED,' ','x'))),'0123456789.',' x'))),0),0,' ','REG_YEAR_ESTABLISED:'||l_invalid_number) REG_YEAR_ESTABLISED,
15040 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_EMPLOYEE_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_EMPLOYEE_TOTAL:'||l_invalid_number) ATT_EMPLOYEE_TOTAL,
15041 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_FLOOR,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_FLOOR:'||l_invalid_number) ATT_FLOOR,
15042 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_HOUSE_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_HOUSE_NUMBER:'||l_invalid_number) ATT_HOUSE_NUMBER,
15043 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_PO_BOX_NO,' ','x'))),'0123456789.',' x'))),0),0,' ','ATT_PO_BOX_NO:'||l_invalid_number) ATT_PO_BOX_NO,
15044 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_FLOOR)),'x')),50) - 50,0,' ','REG_FLOOR:'||l_invalid_size||'(50)') REG_FLOOR,
15045 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PO_BOX_NO)),'x')),50) - 50,0,' ','REG_PO_BOX_NO:'||l_invalid_size||'(50)') REG_PO_BOX_NO,
15046 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_POSTAL_PLUS4_CODE)),'x')),4) - 4,0,' ','REG_POSTAL_PLUS4_CODE:'||l_invalid_size||'(4)') REG_POSTAL_PLUS4_CODE,
15047 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_POSTAL_PLUS4_CODE)),'x')),4) - 4,0,' ','ATT_POSTAL_PLUS4_CODE:'||l_invalid_size||'(4)') ATT_POSTAL_PLUS4_CODE,
15048 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STREET)),'x')),50) - 50,0,' ','REG_STREET:'||l_invalid_size||'(50)') REG_STREET,
15049 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STREET_NUMBER)),'x')),50) - 50,0,' ','REG_STREET_NUMBER:'||l_invalid_size||'(50)') REG_STREET_NUMBER,
15050 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STREET_SUFFIX)),'x')),50) - 50,0,' ','REG_STREET_SUFFIX:'||l_invalid_size||'(50)') REG_STREET_SUFFIX,
15051 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SUITE)),'x')),50) - 50,0,' ','REG_SUITE:'||l_invalid_size||'(50)') REG_SUITE,
15052 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS_LINE_PHOENETIC)),'x')),360) -360,0,' ','REG_ADDRESS_LINE_PHOENETIC:'||l_invalid_size||'(360)') REG_ADDRESS_LINE_PHOENETIC,
15053 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS_LINE_PHOENETIC)),'x')),360) -360,0,' ','ATT_ADDRESS_LINE_PHOENETIC:'||l_invalid_size||'(360)') ATT_ADDRESS_LINE_PHOENETIC,
15054 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CEO_NAME)),'x')),360) -360,0,' ','REG_CEO_NAME:'||l_invalid_size||'(360)') REG_CEO_NAME,
15055 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CEO_NAME)),'x')),360) -360,0,' ','ATT_CEO_NAME:'||l_invalid_size||'(360)') ATT_CEO_NAME,
15056 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_DEPARTMENT)),'x')),360) -360,0,' ','REG_DEPARTMENT:'||l_invalid_size||'(360)') REG_DEPARTMENT,
15057 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_DEPARTMENT)),'x')),360) -360,0,' ','ATT_DEPARTMENT:'||l_invalid_size||'(360)') ATT_DEPARTMENT,
15058 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_DUN_NO_C)),'x')),30) - 30,0,' ','REG_DUN_NO_C:'||l_invalid_size||'(30)') REG_DUN_NO_C,
15059 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_DUN_NO)),'x')),30) - 30,0,' ','ATT_DUN_NO:'||l_invalid_size||'(30)') ATT_DUN_NO,
15060 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_FY_END_MONTH)),'x')),30) - 30,0,' ','ATT_FY_END_MONTH:'||l_invalid_size||'(30)') ATT_FY_END_MONTH,
15061 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_FY_END_MONTH)),'x')),30) - 30,0,' ','REG_FY_END_MONTH:'||l_invalid_size||'(30)') REG_FY_END_MONTH,
15062 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SIC_CODE)),'x')),30) - 30,0,' ','ATT_SIC_CODE:'||l_invalid_size||'(30)') ATT_SIC_CODE,
15063 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SIC_CODE_TYPE)),'x')),30) - 30,0,' ','ATT_SIC_CODE_TYPE:'||l_invalid_size||'(30)') ATT_SIC_CODE_TYPE,
15064 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ORG_LEGAL_STATUS)),'x')),30) - 30,0,' ','REG_ORG_LEGAL_STATUS:'||l_invalid_size||'(30)') REG_ORG_LEGAL_STATUS,
15065 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SITE_USE_CODE)),'x')),30) - 30,0,' ','ATT_SITE_USE_CODE:'||l_invalid_size||'(30)') ATT_SITE_USE_CODE,
15066 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STREET)),'x')),30) - 30,0,' ','ATT_STREET:'||l_invalid_size||'(30)') ATT_STREET,
15067 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STREET_NUMBER)),'x')),30) - 30,0,' ','ATT_STREET_NUMBER:'||l_invalid_size||'(30)') ATT_STREET_NUMBER,
15068 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STREET_SUFFIX)),'x')),30) - 30,0,' ','ATT_STREET_SUFFIX:'||l_invalid_size||'(30)') ATT_STREET_SUFFIX,
15069 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SUITE)),'x')),30) - 30,0,' ','ATT_SUITE:'||l_invalid_size||'(30)') ATT_SUITE,
15070 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_LEGAL_STATUS)),'x')),30) - 30,0,' ','ATT_LEGAL_STATUS:'||l_invalid_size||'(30)') ATT_LEGAL_STATUS,
15071 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_NAME_SUFFIX)),'x')),30) - 30,0,' ','REG_NAME_SUFFIX:'||l_invalid_size||'(30)') REG_NAME_SUFFIX,
15072 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_NAME_SUFFIX)),'x')),30) - 30,0,' ','ATT_NAME_SUFFIX:'||l_invalid_size||'(30)') ATT_NAME_SUFFIX,
15073 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SIC_CODE_TYPE)),'x')),30) - 30,0,' ','REG_SIC_CODE_TYPE:'||l_invalid_size||'(30)') REG_SIC_CODE_TYPE,
15074 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SITE_USE_CODE)),'x')),30) - 30,0,' ','REG_SITE_USE_CODE:'||l_invalid_size||'(30)') REG_SITE_USE_CODE,
15075 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_TAX_NAME)),'x')),30) - 30,0,' ','REG_TAX_NAME:'||l_invalid_size||'(30)') REG_TAX_NAME,
15076 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_TAX_NAME)),'x')),30) - 30,0,' ','ATT_TAX_NAME:'||l_invalid_size||'(30)') ATT_TAX_NAME,
15077 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_JGZZ_FISCAL_CODE)),'x')),20) - 20,0,' ','REG_JGZZ_FISCAL_CODE:'||l_invalid_size||'(20)') REG_JGZZ_FISCAL_CODE,
15078 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_JGZZ_FISCAL_CODE)),'x')),20) - 20,0,' ','ATT_JGZZ_FISCAL_CODE:'||l_invalid_size||'(20)') ATT_JGZZ_FISCAL_CODE,
15079 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_MISSION_STATEMENT)),'x')),2000) - 2000,0,' ','ATT_MISSION_STATEMENT:'||l_invalid_size||'(2000)') ATT_MISSION_STATEMENT,
15080 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ORG_NAME_PHOENETIC)),'x')),320) - 320,0,' ','REG_ORG_NAME_PHOENETIC:'||l_invalid_size||'(320)') REG_ORG_NAME_PHOENETIC,
15081 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ORG_NAME_PHOENETIC)),'x')),320) - 320,0,' ','ATT_ORG_NAME_PHOENETIC:'||l_invalid_size||'(320)') ATT_ORG_NAME_PHOENETIC,
15082 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_MISSION_STATEMENT)),'x')),2000) - 2000,0,' ','REG_MISSION_STATEMENT:'||l_invalid_size||'(2000)') REG_MISSION_STATEMENT,
15083 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_LINE_OF_BUSINESS)),'x')),240) - 240,0,' ','REG_LINE_OF_BUSINESS:'||l_invalid_size||'(240)') REG_LINE_OF_BUSINESS,
15084 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SERVEY_NOTES)),'x')),240) - 240,0,' ','ATT_SERVEY_NOTES:'||l_invalid_size||'(240)') ATT_SERVEY_NOTES,
15085 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_LINE_OF_BUSINESS)),'x')),240) - 240,0,' ','ATT_LINE_OF_BUSINESS:'||l_invalid_size||'(240)') ATT_LINE_OF_BUSINESS,
15086 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SERVEY_NOTES)),'x')),240) - 240,0,' ','REG_SERVEY_NOTES:'||l_invalid_size||'(240)') REG_SERVEY_NOTES
15087 FROM ams_event_mapping_v
15088 WHERE import_list_header_id = p_import_list_header_id
15089 and load_status in ('ACTIVE','RELOAD')
15090 and
15091 (
15092 DECODE(GREATEST(lengthb(LTRIM(RTRIM(EVENT_SOURCE_CODE))),100) - 100,0,'OK','NO') = 'NO'
15093 or
15094 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REGISTRATION_SOURCE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15095 or
15096 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PARTY_NAME)),'x')),360) - 360,0,'OK','NO') = 'NO'
15097 or
15098 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SIC_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15099 or
15100 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SIC_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15101 or
15102 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ANALYSIS_FY)),'x')),5) - 5,0,'OK','NO') = 'NO'
15103 or
15104 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ANALYSIS_FY)),'x')),5) - 5,0,'OK','NO') = 'NO'
15105 or
15106 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CATEGORY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15107 or
15108 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CATEGORY_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15109 or
15110 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_CURRENT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15111 or
15112 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_CURRENT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15113 or
15114 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_NEXT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15115 or
15116 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_NEXT_FY_POTENTIAL_REV,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15117 or
15118 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_TAX_REFERENCE)),'x')),50) - 50,0,'OK','NO') = 'NO'
15119 or
15120 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_TAX_REFERENCE)),'x')),50) - 50,0,'OK','NO') = 'NO'
15121 or
15122 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_YEAR_ESTABLISED,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15123 or
15124 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
15125 or
15126 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_URL)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
15127 or
15128 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
15129 or
15130 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_COUNTRY)),'x')),60) - 60,0,'OK','NO') = 'NO'
15131 or
15132 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
15133 or
15134 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
15135 or
15136 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
15137 or
15138 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
15139 or
15140 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
15141 or
15142 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
15143 or
15144 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
15145 or
15146 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
15147 or
15148 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
15149 or
15150 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS1)),'x')),240) - 240,0,'OK','NO') = 'NO'
15151 or
15152 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS2)),'x')),240) - 240,0,'OK','NO') = 'NO'
15153 or
15154 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS3)),'x')),240) - 240,0,'OK','NO') = 'NO'
15155 or
15156 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS4)),'x')),240) - 240,0,'OK','NO') = 'NO'
15157 or
15158 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CITY)),'x')),60) - 60,0,'OK','NO') = 'NO'
15159 or
15160 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_POSTAL_CODE)),'x')),60) - 60,0,'OK','NO') = 'NO'
15161 or
15162 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STATE)),'x')),60) - 60,0,'OK','NO') = 'NO'
15163 or
15164 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PROVINCE)),'x')),60) - 60,0,'OK','NO') = 'NO'
15165 or
15166 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_COUNTY)),'x')),60) - 60,0,'OK','NO') = 'NO'
15167 or
15168 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
15169 or
15170 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_EMAIL_ADDRESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
15171 or
15172 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_GENDER)),'x')),30) - 30,0,'OK','NO') = 'NO'
15173 or
15174 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_GENDER)),'x')),30) - 30,0,'OK','NO') = 'NO'
15175 or
15176 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_LAST_NAME)),'x')),50) - 50,0,'OK','NO') = 'NO'
15177 or
15178 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_FIRST_NAME)),'x')),40) - 40,0,'OK','NO') = 'NO'
15179 or
15180 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_LAST_NAME)),'x')),50) - 50,0,'OK','NO') = 'NO'
15181 or
15182 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_FIRST_NAME)),'x')),40) - 40,0,'OK','NO') = 'NO'
15183 or
15184 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15185 or
15186 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_TITLE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15187 or
15188 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_JOB_TITLE)),'x')),100) - 100,0,'OK','NO') = 'NO'
15189 or
15190 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_JOB_TITLE)),'x')),100) - 100,0,'OK','NO') = 'NO'
15191 or
15192 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
15193 or
15194 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
15195 or
15196 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_COUNTRY_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
15197 or
15198 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PHONE_EXTENSION)),'x')),20) - 20,0,'OK','NO') = 'NO'
15199 or
15200 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_NUMBER)),'x')),25) - 25,0,'OK','NO') = 'NO'
15201 or
15202 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_AREA_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
15203 or
15204 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_COUNTRY_CODE)),'x')),10) - 10,0,'OK','NO') = 'NO'
15205 or
15206 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PHONE_EXTENSION)),'x')),20) - 20,0,'OK','NO') = 'NO'
15207 or
15208 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_MIDDLE_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
15209 or
15210 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_MIDDLE_NAME)),'x')),60) - 60,0,'OK','NO') = 'NO'
15211 or
15212 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATTENDANCE_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15213 or
15214 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CANCELLATION_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15215 or
15216 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_DECISION_MAKER_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15217 or
15218 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_GSA_INDICATOR_FLAG)),'x')),30) - 30,0,'OK','NO') = 'NO'
15219 or
15220 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_IDENTIFYING_ADDRESS_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15221 or
15222 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_IDENTIFYING_ADDRESS_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15223 or
15224 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CONTACT_ME_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15225 or
15226 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_EMAIL_OK_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15227 or
15228 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_APT_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15229 or
15230 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_DECISION_MAKER_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15231 or
15232 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CONTACT_ME_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15233 or
15234 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_EMAIL_OK_FLAG)),'x')),1) - 1,0,'OK','NO') = 'NO'
15235 or
15236 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CANCELLATION_REASON_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15237 or
15238 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(CONFIRMATION_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15239 or
15240 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PARTY_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15241 or
15242 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PARTY_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15243 or
15244 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIGINAL_SYSTEM_REFERENCE)),'x')),240) - 240,0,'OK','NO') = 'NO'
15245 or
15246 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_PARTY_NAME)),'x')),360) - 360,0,'OK','NO') = 'NO'
15247 or
15248 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15249 or
15250 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_PARTY_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15251 or
15252 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_CONTACT_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15253 or
15254 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_CONTACT_ID,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15255 or
15256 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_HOUSEHOLD_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15257 or
15258 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_HOUSEHOLD_INCOME,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15259 or
15260 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_EMPLOYEE_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15261 or
15262 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_HOUSE_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15263 or
15264 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(REG_YEAR_ESTABLISED,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15265 or
15266 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_EMPLOYEE_TOTAL,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15267 or
15268 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_FLOOR,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15269 or
15270 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_HOUSE_NUMBER,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15271 or
15272 DECODE(NVL(lengthb(trim(TRANSLATE(LTRIM(RTRIM(REPLACE(ATT_PO_BOX_NO,' ','x'))),'0123456789.',' x'))),0),0,'OK','NO') = 'NO'
15273 or
15274 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_FLOOR)),'x')),50) - 50,0,'OK','NO') = 'NO'
15275 or
15276 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_PO_BOX_NO)),'x')),50) - 50,0,'OK','NO') = 'NO'
15277 or
15278 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_POSTAL_PLUS4_CODE)),'x')),4) - 4,0,'OK','NO') = 'NO'
15279 or
15280 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_POSTAL_PLUS4_CODE)),'x')),4) - 4,0,'OK','NO') = 'NO'
15281 or
15282 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STREET)),'x')),50) - 50,0,'OK','NO') = 'NO'
15283 or
15284 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STREET_NUMBER)),'x')),50) - 50,0,'OK','NO') = 'NO'
15285 or
15286 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_STREET_SUFFIX)),'x')),50) - 50,0,'OK','NO') = 'NO'
15287 or
15288 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SUITE)),'x')),50) - 50,0,'OK','NO') = 'NO'
15289 or
15290 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ADDRESS_LINE_PHOENETIC)),'x')),360) - 360,0,'OK','NO') = 'NO'
15291 or
15292 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ADDRESS_LINE_PHOENETIC)),'x')),360) - 360,0,'OK','NO') = 'NO'
15293 or
15294 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_CEO_NAME)),'x')),360) - 360,0,'OK','NO') = 'NO'
15295 or
15296 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_CEO_NAME)),'x')),360) - 360,0,'OK','NO') = 'NO'
15297 or
15298 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_DEPARTMENT)),'x')),360) - 360,0,'OK','NO') = 'NO'
15299 or
15300 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_DEPARTMENT)),'x')),360) - 360,0,'OK','NO') = 'NO'
15301 or
15302 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_DUN_NO_C)),'x')),30) - 30,0,'OK','NO') = 'NO'
15303 or
15304 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_DUN_NO)),'x')),30) - 30,0,'OK','NO') = 'NO'
15305 or
15306 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_FY_END_MONTH)),'x')),30) - 30,0,'OK','NO') = 'NO'
15307 or
15308 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_FY_END_MONTH)),'x')),30) - 30,0,'OK','NO') = 'NO'
15309 or
15310 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SIC_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15311 or
15312 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SIC_CODE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15313 or
15314 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ORG_LEGAL_STATUS)),'x')),30) - 30,0,'OK','NO') = 'NO'
15315 or
15316 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SITE_USE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15317 or
15318 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STREET)),'x')),30) - 30,0,'OK','NO') = 'NO'
15319 or
15320 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STREET_NUMBER)),'x')),30) - 30,0,'OK','NO') = 'NO'
15321 or
15322 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_STREET_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
15323 or
15324 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SUITE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15325 or
15326 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_LEGAL_STATUS)),'x')),30) - 30,0,'OK','NO') = 'NO'
15327 or
15328 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
15329 or
15330 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_NAME_SUFFIX)),'x')),30) - 30,0,'OK','NO') = 'NO'
15331 or
15332 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SIC_CODE_TYPE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15333 or
15334 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_TAX_NAME)),'x')),30) - 30,0,'OK','NO') = 'NO'
15335 or
15336 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_TAX_NAME)),'x')),30) - 30,0,'OK','NO') = 'NO'
15337 or
15338 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SITE_USE_CODE)),'x')),30) - 30,0,'OK','NO') = 'NO'
15339 or
15340 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_JGZZ_FISCAL_CODE)),'x')),20) - 20,0,'OK','NO') = 'NO'
15341 or
15342 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_JGZZ_FISCAL_CODE)),'x')),20) - 20,0,'OK','NO') = 'NO'
15343 or
15344 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_MISSION_STATEMENT)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
15345 or
15346 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_ORG_NAME_PHOENETIC)),'x')),320) - 320,0,'OK','NO') = 'NO'
15347 or
15348 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_ORG_NAME_PHOENETIC)),'x')),320) - 320,0,'OK','NO') = 'NO'
15349 or
15350 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_MISSION_STATEMENT)),'x')),2000) - 2000,0,'OK','NO') = 'NO'
15351 or
15352 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_LINE_OF_BUSINESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
15353 or
15354 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_SERVEY_NOTES)),'x')),240) - 240,0,'OK','NO') = 'NO'
15355 or
15356 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ATT_LINE_OF_BUSINESS)),'x')),240) - 240,0,'OK','NO') = 'NO'
15357 or
15358 DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(REG_SERVEY_NOTES)),'x')),240) - 240,0,'OK','NO') = 'NO'
15359 )
15360 ;
15361
15362 CURSOR c_lead_batch_id is
15363 SELECT
15364 batch_id
15365 FROM ams_imp_list_headers_all
15366 WHERE import_list_header_id = p_import_list_header_id;
15367
15368 begin
15369
15370 IF p_import_list_header_id IS NULL THEN
15371 RAISE FND_API.G_EXC_ERROR;
15372 END IF;
15373 p_return_status := FND_API.G_RET_STS_SUCCESS;
15374
15375 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_DATATYPE_ERROR_CHK');
15376 l_invalid_number := FND_MESSAGE.get;
15377 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_SIZE_ERROR_CHK');
15378 l_invalid_size := FND_MESSAGE.get;
15379 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_COL_NULL_ERROR_CHK');
15380 l_null_value := FND_MESSAGE.get;
15381 FND_MESSAGE.set_name('AMS', 'AMS_IMP_FLD_SOUR_SYS_ERROR_CHK');
15382 l_invalid_src_system := FND_MESSAGE.get;
15383
15384 OPEN c_lead_batch_id;
15385 FETCH c_lead_batch_id into l_batch_id;
15386 CLOSE c_lead_batch_id;
15387
15388 OPEN c_event_fields;
15389 LOOP
15390 FETCH c_event_fields BULK COLLECT INTO
15391 l_import_source_line_id,
15392 l_import_list_header_id,
15393 l_col1 ,
15394 l_col2 ,
15395 l_col3 ,
15396 l_col4 ,
15397 l_col5 ,
15398 l_col6 ,
15399 l_col7 ,
15400 l_col8 ,
15401 l_col9 ,
15402 l_col10 ,
15403 l_col11 ,
15404 l_col12 ,
15405 l_col13 ,
15406 l_col14 ,
15407 l_col15 ,
15408 l_col16 ,
15409 l_col17 ,
15410 l_col18 ,
15411 l_col19 ,
15412 l_col20 ,
15413 l_col21 ,
15414 l_col22 ,
15415 l_col23 ,
15416 l_col24 ,
15417 l_col25 ,
15418 l_col26 ,
15419 l_col27 ,
15420 l_col28 ,
15421 l_col29 ,
15422 l_col30 ,
15423 l_col31 ,
15424 l_col32 ,
15425 l_col33 ,
15426 l_col34 ,
15427 l_col35 ,
15428 l_col36 ,
15429 l_col37 ,
15430 l_col38 ,
15431 l_col39 ,
15432 l_col40 ,
15433 l_col41 ,
15434 l_col42 ,
15435 l_col43 ,
15436 l_col44 ,
15437 l_col45 ,
15438 l_col46 ,
15439 l_col47 ,
15440 l_col48 ,
15441 l_col49 ,
15442 l_col50 ,
15443 l_col51 ,
15444 l_col52 ,
15445 l_col53 ,
15446 l_col54 ,
15447 l_col55 ,
15448 l_col56 ,
15449 l_col57 ,
15450 l_col58 ,
15451 l_col59 ,
15452 l_col60 ,
15453 l_col61 ,
15454 l_col62 ,
15455 l_col63 ,
15456 l_col64 ,
15457 l_col65 ,
15458 l_col66 ,
15459 l_col67 ,
15460 l_col68 ,
15461 l_col69 ,
15462 l_col70 ,
15463 l_col71 ,
15464 l_col72 ,
15465 l_col73 ,
15466 l_col74 ,
15467 l_col75 ,
15468 l_col76 ,
15469 l_col77 ,
15470 l_col78 ,
15471 l_col79 ,
15472 l_col80 ,
15473 l_col81 ,
15474 l_col82 ,
15475 l_col83 ,
15476 l_col84 ,
15477 l_col85 ,
15478 l_col86 ,
15479 l_col87 ,
15480 l_col88 ,
15481 l_col89 ,
15482 l_col90 ,
15483 l_col91 ,
15484 l_col92 ,
15485 l_col93 ,
15486 l_col94 ,
15487 l_col95 ,
15488 l_col96 ,
15489 l_col97 ,
15490 l_col98 ,
15491 l_col99 ,
15492 l_col100 ,
15493 l_col101 ,
15494 l_col102 ,
15495 l_col103 ,
15496 l_col104 ,
15497 l_col105 ,
15498 l_col106 ,
15499 l_col107 ,
15500 l_col108 ,
15501 l_col109 ,
15502 l_col110 ,
15503 l_col111 ,
15504 l_col112 ,
15505 l_col113 ,
15506 l_col114 ,
15507 l_col115 ,
15508 l_col116 ,
15509 l_col117 ,
15510 l_col118 ,
15511 l_col119 ,
15512 l_col120 ,
15513 l_col121 ,
15514 l_col122 ,
15515 l_col123 ,
15516 l_col124 ,
15517 l_col125 ,
15518 l_col126 ,
15519 l_col127 ,
15520 l_col128 ,
15521 l_col129 ,
15522 l_col130 ,
15523 l_col131 ,
15524 l_col132 ,
15525 l_col133 ,
15526 l_col134 ,
15527 l_col135
15528 LIMIT L_MAX_ROW_COUNT;
15529
15530
15531 FORALL i IN 1 .. l_import_source_line_id.count
15532 INSERT INTO ams_list_import_errors
15533 (
15534 LIST_IMPORT_ERROR_ID,
15535 LAST_UPDATED_BY,
15536 LAST_UPDATE_DATE,
15537 CREATION_DATE,
15538 CREATED_BY,
15539 LAST_UPDATE_LOGIN,
15540 IMPORT_SOURCE_LINE_ID,
15541 IMPORT_LIST_HEADER_ID,
15542 IMPORT_TYPE,
15543 ERROR_TYPE,
15544 BATCH_ID,
15545 ERROR_FLAG,
15546 col1 ,
15547 col2 ,
15548 col3 ,
15549 col4 ,
15550 col5 ,
15551 col6 ,
15552 col7 ,
15553 col8 ,
15554 col9 ,
15555 col10 ,
15556 col11 ,
15557 col12 ,
15558 col13 ,
15559 col14 ,
15560 col15 ,
15561 col16 ,
15562 col17 ,
15563 col18 ,
15564 col19 ,
15565 col20 ,
15566 col21 ,
15567 col22 ,
15568 col23 ,
15569 col24 ,
15570 col25 ,
15571 col26 ,
15572 col27 ,
15573 col28 ,
15574 col29 ,
15575 col30 ,
15576 col31 ,
15577 col32 ,
15578 col33 ,
15579 col34 ,
15580 col35 ,
15581 col36 ,
15582 col37 ,
15583 col38 ,
15584 col39 ,
15585 col40 ,
15586 col41 ,
15587 col42 ,
15588 col43 ,
15589 col44 ,
15590 col45 ,
15591 col46 ,
15592 col47 ,
15593 col48 ,
15594 col49 ,
15595 col50 ,
15596 col51 ,
15597 col52 ,
15598 col53 ,
15599 col54 ,
15600 col55 ,
15601 col56 ,
15602 col57 ,
15603 col58 ,
15604 col59 ,
15605 col60 ,
15606 col61 ,
15607 col62 ,
15608 col63 ,
15609 col64 ,
15610 col65 ,
15611 col66 ,
15612 col67 ,
15613 col68 ,
15614 col69 ,
15615 col70 ,
15616 col71 ,
15617 col72 ,
15618 col73 ,
15619 col74 ,
15620 col75 ,
15621 col76 ,
15622 col77 ,
15623 col78 ,
15624 col79 ,
15625 col80 ,
15626 col81 ,
15627 col82 ,
15628 col83 ,
15629 col84 ,
15630 col85 ,
15631 col86 ,
15632 col87 ,
15633 col88 ,
15634 col89 ,
15635 col90 ,
15636 col91 ,
15637 col92 ,
15638 col93 ,
15639 col94 ,
15640 col95 ,
15641 col96 ,
15642 col97 ,
15643 col98 ,
15644 col99 ,
15645 col100 ,
15646 col101 ,
15647 col102 ,
15648 col103 ,
15649 col104 ,
15650 col105 ,
15651 col106 ,
15652 col107 ,
15653 col108 ,
15654 col109 ,
15655 col110 ,
15656 col111 ,
15657 col112 ,
15658 col113 ,
15659 col114 ,
15660 col115 ,
15661 col116 ,
15662 col117 ,
15663 col118 ,
15664 col119 ,
15665 col120 ,
15666 col121 ,
15667 col122 ,
15668 col123 ,
15669 col124 ,
15670 col125 ,
15671 col126 ,
15672 col127 ,
15673 col128 ,
15674 col129 ,
15675 col130 ,
15676 col131 ,
15677 col132 ,
15678 col133 ,
15679 col134 ,
15680 col135
15681 )
15682 VALUES
15683 (
15684 ams_list_import_errors_s.nextval, -- LIST_IMPORT_ERROR_ID,
15685 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
15686 SYSDATE, -- LAST_UPDATE_DATE,
15687 SYSDATE, -- CREATION_DATE,
15688 FND_GLOBAL.User_ID, -- CREATED_BY,
15689 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
15690 l_import_source_line_id(i),
15691 l_import_list_header_id(i),
15692 'EVENT', -- IMPORT_TYPE,
15693 'E', -- ERROR_TYPE,
15694 l_batch_id,
15695 'Y',
15696 l_col1(i),
15697 l_col2(i),
15698 l_col3(i),
15699 l_col4(i),
15700 l_col5(i),
15701 l_col6(i),
15702 l_col7(i),
15703 l_col8(i),
15704 l_col9(i),
15705 l_col10(i),
15706 l_col11(i),
15707 l_col12(i),
15708 l_col13(i),
15709 l_col14(i),
15710 l_col15(i),
15711 l_col16(i),
15712 l_col17(i),
15713 l_col18(i),
15714 l_col19(i),
15715 l_col20(i),
15716 l_col21(i),
15717 l_col22(i),
15718 l_col23(i),
15719 l_col24(i),
15720 l_col25(i),
15721 l_col26(i),
15722 l_col27(i),
15723 l_col28(i),
15724 l_col29(i),
15725 l_col30(i),
15726 l_col31(i),
15727 l_col32(i),
15728 l_col33(i),
15729 l_col34(i),
15730 l_col35(i),
15731 l_col36(i),
15732 l_col37(i),
15733 l_col38(i),
15734 l_col39(i),
15735 l_col40(i),
15736 l_col41(i),
15737 l_col42(i),
15738 l_col43(i),
15739 l_col44(i),
15740 l_col45(i),
15741 l_col46(i),
15742 l_col47(i),
15743 l_col48(i),
15744 l_col49(i),
15745 l_col50(i),
15746 l_col51(i),
15747 l_col52(i),
15748 l_col53(i),
15749 l_col54(i),
15750 l_col55(i),
15751 l_col56(i),
15752 l_col57(i),
15753 l_col58(i),
15754 l_col59(i),
15755 l_col60(i),
15756 l_col61(i),
15757 l_col62(i),
15758 l_col63(i),
15759 l_col64(i),
15760 l_col65(i),
15761 l_col66(i),
15762 l_col67(i),
15763 l_col68(i),
15764 l_col69(i),
15765 l_col70(i),
15766 l_col71(i),
15767 l_col72(i),
15768 l_col73(i),
15769 l_col74(i),
15770 l_col75(i),
15771 l_col76(i),
15772 l_col77(i),
15773 l_col78(i),
15774 l_col79(i),
15775 l_col80(i),
15776 l_col81(i),
15777 l_col82(i),
15778 l_col83(i),
15779 l_col84(i),
15780 l_col85(i),
15781 l_col86(i),
15782 l_col87(i),
15783 l_col88(i),
15784 l_col89(i),
15785 l_col90(i),
15786 l_col91(i),
15787 l_col92(i),
15788 l_col93(i),
15789 l_col94(i),
15790 l_col95(i),
15791 l_col96(i),
15792 l_col97(i),
15793 l_col98(i),
15794 l_col99(i),
15795 l_col100(i),
15796 l_col101(i),
15797 l_col102(i),
15798 l_col103(i),
15799 l_col104(i),
15800 l_col105(i),
15801 l_col106(i),
15802 l_col107(i),
15803 l_col108(i),
15804 l_col109(i),
15805 l_col110(i),
15806 l_col111(i),
15807 l_col112(i),
15808 l_col113(i),
15809 l_col114(i),
15810 l_col115(i),
15811 l_col116(i),
15812 l_col117(i),
15813 l_col118(i),
15814 l_col119(i),
15815 l_col120(i),
15816 l_col121(i),
15817 l_col122(i),
15818 l_col123(i),
15819 l_col124(i),
15820 l_col125(i),
15821 l_col126(i),
15822 l_col127(i),
15823 l_col128(i),
15824 l_col129(i),
15825 l_col130(i),
15826 l_col131(i),
15827 l_col132(i),
15828 l_col133(i),
15829 l_col134(i),
15830 l_col135(i)
15831 );
15832 EXIT WHEN c_event_fields%NOTFOUND;
15833 END LOOP;
15834 CLOSE c_event_fields;
15835
15836 UPDATE ams_imp_source_lines
15837 SET load_status = 'ERROR'
15838 WHERE import_list_header_id = p_import_list_header_id
15839 and import_source_line_id in
15840 (select import_source_line_id from ams_list_import_errors
15841 where import_list_header_id = p_import_list_header_id
15842 and error_type = 'E');
15843
15844
15845 EXCEPTION
15846 WHEN OTHERS THEN
15847 p_return_status := FND_API.G_RET_STS_ERROR;
15848 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
15849 FND_MESSAGE.Set_Token('ROW','Error in execute_event_data_validation:' || SQLERRM||' '||SQLCODE);
15850 AMS_Utility_PVT.Create_Log (
15851 x_return_status => l_return_status,
15852 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
15853 p_log_used_by_id => p_import_list_header_id,
15854 p_msg_data => FND_MESSAGE.get,
15855 p_msg_type => 'DEBUG'
15856 );
15857
15858 end execute_event_data_validation;
15859
15860 --
15861 -- This procedure generates the status of import
15862 --
15863 --
15864 PROCEDURE process_status_code (
15865 p_import_list_header_id IN NUMBER
15866 ) is
15867
15868
15869 l_tot_numb_records NUMBER;
15870 l_tot_numb_error_records NUMBER;
15871 l_tot_numb_dup_records NUMBER;
15872 l_tot_numb_success_records NUMBER;
15873 l_tot_numb_active_records NUMBER;
15874 l_status_code VARCHAR2(30);
15875 l_user_status_id NUMBER;
15876 L_RETURN_STATUS VARCHAR2(1);
15877
15878
15879
15880 cursor c_tot_numb_records is
15881 select count(*) from ams_imp_source_lines
15882 where import_list_header_id = p_import_list_header_id;
15883
15884 cursor c_tot_numb_error_records is
15885 select count(*) from ams_imp_source_lines
15886 where import_list_header_id = p_import_list_header_id
15887 and load_status = G_STATUS_ERROR;
15888
15889 cursor c_tot_numb_dup_records is
15890 select count(*) from ams_imp_source_lines
15891 where import_list_header_id = p_import_list_header_id
15892 and load_status = G_STATUS_DUPLICATE;
15893
15894 cursor c_tot_numb_success_records is
15895 select count(*) from ams_imp_source_lines
15896 where import_list_header_id = p_import_list_header_id
15897 and load_status = G_STATUS_SUCCESS;
15898
15899 cursor c_tot_numb_active_records is
15900 select count(*) from ams_imp_source_lines
15901 where import_list_header_id = p_import_list_header_id
15902 and load_status in ('ACTIVE','RELOAD');
15903
15904
15905
15906
15907 begin
15908 open c_tot_numb_records;
15909 fetch c_tot_numb_records into l_tot_numb_records;
15910 close c_tot_numb_records;
15911
15912 open c_tot_numb_error_records;
15913 fetch c_tot_numb_error_records into l_tot_numb_error_records;
15914 close c_tot_numb_error_records;
15915
15916 open c_tot_numb_dup_records;
15917 fetch c_tot_numb_dup_records into l_tot_numb_dup_records;
15918 close c_tot_numb_dup_records;
15919
15920 open c_tot_numb_success_records;
15921 fetch c_tot_numb_success_records into l_tot_numb_success_records;
15922 close c_tot_numb_success_records;
15923
15924 open c_tot_numb_active_records;
15925 fetch c_tot_numb_active_records into l_tot_numb_active_records;
15926 close c_tot_numb_active_records;
15927
15928 -- ALL SUCCESSFUL
15929 if (((l_tot_numb_records = l_tot_numb_success_records) and l_tot_numb_records > 0)
15930 and l_tot_numb_error_records = 0 and l_tot_numb_dup_records = 0) then
15931 l_status_code := 'COMPLETED';
15932 end if;
15933
15934 -- ALL ERROR
15935 if (((l_tot_numb_records = l_tot_numb_error_records) and l_tot_numb_records > 0)
15936 and l_tot_numb_success_records = 0 and l_tot_numb_dup_records = 0) then
15937 l_status_code := 'ERROR';
15938 end if;
15939
15940 -- ALL DUPLICATE
15941 if (((l_tot_numb_records = l_tot_numb_dup_records) and l_tot_numb_records > 0)
15942 and l_tot_numb_success_records = 0 and l_tot_numb_error_records = 0) then
15943 l_status_code := 'DUPLICATE';
15944 end if;
15945
15946 -- INCOMPLETE WITH ERRORS
15947 if (l_tot_numb_success_records > 0 and l_tot_numb_error_records > 0
15948 and l_tot_numb_dup_records = 0) then
15949 l_status_code := 'INCOMPERR';
15950 end if;
15951
15952 -- INCOMPLETE WITH DUPLICATES
15953 if (l_tot_numb_success_records > 0 and l_tot_numb_dup_records > 0
15954 and l_tot_numb_error_records = 0) then
15955 l_status_code := 'INCOMPDUP';
15956 end if;
15957
15958 -- INCOMPLETE WITH DUPLICATES AND ERRORS
15959 if (l_tot_numb_success_records > 0 and l_tot_numb_dup_records > 0
15960 and l_tot_numb_error_records > 0) then
15961 l_status_code := 'INCOMPDUPERR';
15962 end if;
15963
15964 -- CHECK ACTIVE/RELOAD STATUS RECORD
15965 if l_tot_numb_active_records > 0 then
15966 AMS_Utility_PVT.Create_Log (
15967 x_return_status => l_return_status,
15968 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
15969 p_log_used_by_id => p_import_list_header_id,
15970 p_msg_data => 'Some of the records are not processed .' ,
15971 p_msg_type => 'DEBUG'
15972 );
15973 end if;
15974
15975 if l_status_code is NULL then
15976 l_status_code := 'ERROR';
15977 end if;
15978 l_user_status_id := null;
15979 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
15980 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
15981 system_status_code = l_status_code and default_flag = 'Y';
15982
15983 UPDATE ams_imp_list_headers_all
15984 set status_code = l_status_code,
15985 user_status_id = l_user_status_id,
15986 loaded_no_of_rows = l_tot_numb_success_records,
15987 number_of_duplicate_records = l_tot_numb_dup_records,
15988 number_of_failed_records = l_tot_numb_error_records,
15989 status_date = sysdate
15990 where import_list_header_id = p_import_list_header_id;
15991
15992 exception
15993 WHEN OTHERS THEN
15994 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
15995 FND_MESSAGE.Set_Token('ROW','Error in process_status_code :' || SQLERRM||' '||SQLCODE);
15996 AMS_Utility_PVT.Create_Log (
15997 x_return_status => l_return_status,
15998 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
15999 p_log_used_by_id => p_import_list_header_id,
16000 p_msg_data => FND_MESSAGE.get,
16001 p_msg_type => 'DEBUG'
16002 );
16003
16004 end process_status_code;
16005
16006 -- 00000000000000000000000000000000000000000000000000000000000000000000000000000000
16007 -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
16008 -- This program is for customer import for XML data.
16009
16010 PROCEDURE Process_customers_xml (
16011 p_api_version_number IN NUMBER,
16012 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
16013 p_commit IN VARCHAR2 := FND_API.G_FALSE,
16014 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
16015 x_return_status OUT NOCOPY VARCHAR2,
16016 x_msg_count OUT NOCOPY NUMBER,
16017 x_msg_data OUT NOCOPY VARCHAR2,
16018 p_import_list_header_id IN NUMBER,
16019 p_update_flag IN VARCHAR2
16020 ) IS
16021
16022
16023 root_node_rec_type AMS_IMP_XML_ELEMENTS%ROWTYPE;
16024 l_child_node_rec AMS_IMP_XML_ELEMENTS%ROWTYPE;
16025 l_orgid_data_in_tbl AMS_IMPORT_XML_PVT.xml_element_key_set_type;
16026
16027 l_perid_data_in_tbl AMS_IMPORT_XML_PVT.xml_element_key_set_type;
16028
16029 l_cust_b2b_tbl cust_data_in_tbl;
16030 l_cust_b2c_tbl cust_b2c_data_in_tbl;
16031 l_cust_b2b_rec data_in_rec_type;
16032 l_cust_b2c_rec data_in_rec_b2c_type;
16033
16034 l_b2b_flag VARCHAR2(1);
16035
16036 cursor c_b2b is
16037 select decode(import_type,'B2B','Y','N') from ams_imp_list_headers_all
16038 WHERE import_list_header_id = p_import_list_header_id;
16039
16040 begin
16041
16042 open c_b2b;
16043 fetch c_b2b into l_b2b_flag;
16044 close c_b2b;
16045
16046
16047 /********* Get the Root Node *****************************/
16048
16049 AMS_IMPORT_XML_PVT.Get_Root_Node (
16050 p_import_list_header_id => p_import_list_header_id,
16051 x_node_rec => root_node_rec_type,
16052 x_return_status => x_return_status,
16053 x_msg_data => x_msg_data);
16054
16055 -- dbms_output.put_line( ' Root Id '||root_node_rec_type.IMP_XML_ELEMENT_ID);
16056 IF l_b2b_flag = 'Y' then
16057 /********* Get all the Organizations for the Root Node *****************************/
16058
16059 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16060 p_imp_xml_element_id => root_node_rec_type.IMP_XML_ELEMENT_ID,
16061 x_child_ids => l_orgid_data_in_tbl,
16062 x_return_status => x_return_status,
16063 x_msg_data => x_msg_data);
16064
16065 FOR i IN 1..l_orgid_data_in_tbl.COUNT LOOP
16066 -- dbms_output.put_line( ' Organizations Id '||l_orgid_data_in_tbl(i));
16067 -- dbms_output.put_line( ' Organizations count '||l_orgid_data_in_tbl.COUNT);
16068
16069 Process_b2b_xml_data (
16070 p_import_list_header_id => p_import_list_header_id,
16071 p_xml_element_id => l_orgid_data_in_tbl(i),
16072 p_cust_tbl => l_cust_b2b_tbl,
16073 x_return_status => x_return_status,
16074 x_msg_data => x_msg_data);
16075 -- dbms_output.put_line( ' in Createtotal count '||l_cust_b2b_tbl.COUNT);
16076 Create_b2b_src_lines(
16077 p_import_list_header_id => p_import_list_header_id,
16078 p_cust_b2b_tbl => l_cust_b2b_tbl,
16079 x_return_status => x_return_status,
16080 x_msg_data => x_msg_data);
16081 END LOOP;
16082 /*
16083 Create_b2b_src_lines(
16084 p_import_list_header_id => p_import_list_header_id,
16085 p_cust_b2b_tbl => l_cust_b2b_tbl,
16086 x_return_status => x_return_status,
16087 x_msg_data => x_msg_data);
16088 */
16089 END if;
16090
16091 IF l_b2b_flag = 'N' then
16092 /********* Get all the Persons for the Root Node *****************************/
16093
16094 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16095 p_imp_xml_element_id => root_node_rec_type.IMP_XML_ELEMENT_ID,
16096 x_child_ids => l_perid_data_in_tbl,
16097 x_return_status => x_return_status,
16098 x_msg_data => x_msg_data);
16099
16100 FOR i IN 1..l_perid_data_in_tbl.COUNT LOOP
16101 -- dbms_output.put_line( ' Person Id '||l_perid_data_in_tbl(i));
16102 -- dbms_output.put_line( ' Person count '||l_perid_data_in_tbl.COUNT);
16103
16104 Process_b2c_xml_data (
16105 p_import_list_header_id => p_import_list_header_id,
16106 p_xml_element_id => l_perid_data_in_tbl(i),
16107 p_cust_tbl => l_cust_b2c_tbl,
16108 x_return_status => x_return_status,
16109 x_msg_data => x_msg_data);
16110
16111 Create_b2c_src_lines(
16112 p_import_list_header_id => p_import_list_header_id,
16113 p_cust_b2c_tbl => l_cust_b2c_tbl,
16114 x_return_status => x_return_status,
16115 x_msg_data => x_msg_data);
16116 -- dbms_output.put_line( ' total count '||l_cust_b2c_tbl.COUNT);
16117 END LOOP;
16118 /*
16119 Create_b2c_src_lines(
16120 p_import_list_header_id => p_import_list_header_id,
16121 p_cust_b2c_tbl => l_cust_b2c_tbl,
16122 x_return_status => x_return_status,
16123 x_msg_data => x_msg_data);
16124 */
16125 END if;
16126
16127 exception
16128 WHEN OTHERS THEN
16129 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
16130 FND_MESSAGE.Set_Token('ROW','Error in Process_customers_xml :' || SQLERRM||' '||SQLCODE);
16131 AMS_Utility_PVT.Create_Log (
16132 x_return_status => x_return_status,
16133 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
16134 p_log_used_by_id => p_import_list_header_id,
16135 p_msg_data => FND_MESSAGE.get,
16136 p_msg_type => 'DEBUG'
16137 );
16138
16139
16140
16141 end Process_customers_xml;
16142 -- **********************************************
16143 --
16144 -- This program processes the xml data.
16145
16146 PROCEDURE Process_b2b_xml_data (
16147 p_import_list_header_id IN NUMBER,
16148 p_xml_element_id IN NUMBER,
16149 p_cust_tbl IN OUT NOCOPY cust_data_in_tbl,
16150 x_return_status OUT NOCOPY VARCHAR2,
16151 x_msg_data OUT NOCOPY VARCHAR2
16152 ) IS
16153 l_loc_element_id NUMBER;
16154 l_oct_element_id NUMBER;
16155 l_pho_element_id NUMBER;
16156 l_ema_element_id NUMBER;
16157 l_rec NUMBER := 1;
16158
16159 party_rec hz_party_v2pub.party_rec_type;
16160 org_rec hz_party_v2pub.organization_rec_type;
16161 person_rec hz_party_v2pub.person_rec_type;
16162 location_rec hz_location_v2pub.location_rec_type;
16163 psite_rec hz_party_site_v2pub.party_site_rec_type;
16164 cpoint_rec hz_contact_point_v2pub.contact_point_rec_type;
16165 email_rec hz_contact_point_v2pub.email_rec_type;
16166 phone_rec hz_contact_point_v2pub.phone_rec_type;
16167 ocon_rec hz_party_contact_v2pub.org_contact_rec_type;
16168 edi_rec hz_contact_point_v2pub.edi_rec_type;
16169 telex_rec hz_contact_point_v2pub.telex_rec_type;
16170 web_rec hz_contact_point_v2pub.web_rec_type;
16171
16172
16173 l_orgid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16174 l_locid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16175 l_addid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16176 l_octid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16177 l_conid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16178 l_phoid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16179 l_phiid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16180 l_emaid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16181 l_emlid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
16182 l_customer_tbl cust_data_in_tbl;
16183
16184 begin
16185 /********* Get all the elements for the Organizations *****************************/
16186 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16187 p_imp_xml_element_id => p_xml_element_id,
16188 x_child_set => l_orgid_record_in_tbl,
16189 x_return_status => x_return_status,
16190 x_msg_data => x_msg_data);
16191
16192 -- dbms_output.put_line( ' Organizations attribute count '||l_orgid_record_in_tbl.COUNT);
16193 /*
16194 FOR i IN 1..l_orgid_record_in_tbl.COUNT LOOP
16195 -- dbms_output.put_line('Org att '||l_orgid_record_in_tbl(i).column_name||'>>>'||l_orgid_record_in_tbl(i).data);
16196 END LOOP;
16197 */
16198 l_customer_tbl(l_rec).cust_data_id := l_rec;
16199 l_customer_tbl(l_rec).org_imp_xml_element_id := p_xml_element_id;
16200 l_customer_tbl(l_rec).PARTY_NAME := Get_Element_VALUE('PARTY_NAME',l_orgid_record_in_tbl);
16201 l_customer_tbl(l_rec).FISCAL_YEAREND_MONTH := Get_Element_VALUE('FISCAL_YEAREND_MONTH',l_orgid_record_in_tbl);
16202 l_customer_tbl(l_rec).DUNS_NUMBER := Get_Element_VALUE('DUNS_NUMBER',l_orgid_record_in_tbl);
16203 l_customer_tbl(l_rec).EMPLOYEES_TOTAL := Get_Element_VALUE('EMPLOYEES_TOTAL',l_orgid_record_in_tbl);
16204 l_customer_tbl(l_rec).LINE_OF_BUSINESS := Get_Element_VALUE('LINE_OF_BUSINESS',l_orgid_record_in_tbl);
16205 l_customer_tbl(l_rec).YEAR_ESTABLISHED := Get_Element_VALUE('YEAR_ESTABLISHED',l_orgid_record_in_tbl);
16206 l_customer_tbl(l_rec).TAX_REFERENCE := Get_Element_VALUE('TAX_REFERENCE',l_orgid_record_in_tbl);
16207 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := Get_Element_VALUE('ORIG_SYSTEM_REFERENCE',l_orgid_record_in_tbl);
16208 l_customer_tbl(l_rec).CEO_NAME := Get_Element_VALUE('CEO_NAME',l_orgid_record_in_tbl);
16209 l_customer_tbl(l_rec).SIC_CODE := Get_Element_VALUE('SIC_CODE',l_orgid_record_in_tbl);
16210 l_customer_tbl(l_rec).SIC_CODE_TYPE := Get_Element_VALUE('SIC_CODE_TYPE',l_orgid_record_in_tbl);
16211 l_customer_tbl(l_rec).ANALYSIS_FY := Get_Element_VALUE('ANALYSIS_FY',l_orgid_record_in_tbl);
16212 l_customer_tbl(l_rec).CURR_FY_POTENTIAL_REVENUE := Get_Element_VALUE('CURR_FY_POTENTIAL_REVENUE',l_orgid_record_in_tbl);
16213 l_customer_tbl(l_rec).NEXT_FY_POTENTIAL_REVENUE := Get_Element_VALUE('NEXT_FY_POTENTIAL_REVENUE',l_orgid_record_in_tbl);
16214 l_customer_tbl(l_rec).GSA_INDICATOR_FLAG := Get_Element_VALUE('GSA_INDICATOR_FLAG',l_orgid_record_in_tbl);
16215 l_customer_tbl(l_rec).MISSION_STATEMENT := Get_Element_VALUE('MISSION_STATEMENT',l_orgid_record_in_tbl);
16216 l_customer_tbl(l_rec).ORGANIZATION_NAME_PHONETIC := Get_Element_VALUE('ORGANIZATION_NAME_PHONETIC',l_orgid_record_in_tbl);
16217 l_customer_tbl(l_rec).CATEGORY_CODE := Get_Element_VALUE('CATEGORY_CODE',l_orgid_record_in_tbl);
16218 l_customer_tbl(l_rec).JGZZ_FISCAL_CODE := Get_Element_VALUE('JGZZ_FISCAL_CODE',l_orgid_record_in_tbl);
16219 l_customer_tbl(l_rec).PARTY_ID := Get_Element_VALUE('PARTY_ID',l_orgid_record_in_tbl);
16220
16221 l_customer_tbl(l_rec).BRANCH_FLAG := Get_Element_VALUE('BRANCH_FLAG',l_orgid_record_in_tbl);
16222 l_customer_tbl(l_rec).BUSINESS_LINE := Get_Element_VALUE('BUSINESS_LINE',l_orgid_record_in_tbl);
16223 l_customer_tbl(l_rec).BUSINESS_SCOPE := Get_Element_VALUE('BUSINESS_SCOPE',l_orgid_record_in_tbl);
16224 l_customer_tbl(l_rec).CHIEF_EXECUTIVE_TITLE := Get_Element_VALUE('CHIEF_EXECUTIVE_TITLE',l_orgid_record_in_tbl);
16225 l_customer_tbl(l_rec).CONGRESSIONAL_DISTRICT_CODE := Get_Element_VALUE('CONGRESSIONAL_DISTRICT_CODE',l_orgid_record_in_tbl);
16226 l_customer_tbl(l_rec).CONTROL_YEAR := Get_Element_VALUE('CONTROL_YEAR',l_orgid_record_in_tbl);
16227 l_customer_tbl(l_rec).CORPORATION_CLASS := Get_Element_VALUE('CORPORATION_CLASS',l_orgid_record_in_tbl);
16228 l_customer_tbl(l_rec).CREDIT_SCORE := Get_Element_VALUE('CREDIT_SCORE',l_orgid_record_in_tbl);
16229 l_customer_tbl(l_rec).CREDIT_SCORE_COMMENTARY := Get_Element_VALUE('CREDIT_SCORE_COMMENTARY',l_orgid_record_in_tbl);
16230 l_customer_tbl(l_rec).CUSTOMER_CATEGORY := Get_Element_VALUE('CUSTOMER_CATEGORY',l_orgid_record_in_tbl);
16231 l_customer_tbl(l_rec).DB_RATING := Get_Element_VALUE('DB_RATING',l_orgid_record_in_tbl);
16232 l_customer_tbl(l_rec).DEBARMENTS_COUNT := Get_Element_VALUE('DEBARMENTS_COUNT',l_orgid_record_in_tbl);
16233 l_customer_tbl(l_rec).DEBARTMENTS_DATE := Get_Element_VALUE('DEBARTMENTS_DATE',l_orgid_record_in_tbl);
16234 l_customer_tbl(l_rec).DEPARTMENT_INDICATOR := Get_Element_VALUE('DEPARTMENT_INDICATOR',l_orgid_record_in_tbl);
16235 l_customer_tbl(l_rec).DISADVANTAGED_INDICATOR := Get_Element_VALUE('DISADVANTAGED_INDICATOR',l_orgid_record_in_tbl);
16236 l_customer_tbl(l_rec).ENQUIRY_DUNS := Get_Element_VALUE('ENQUIRY_DUNS',l_orgid_record_in_tbl);
16237 l_customer_tbl(l_rec).EXPORT_INDICATOR := Get_Element_VALUE('EXPORT_INDICATOR',l_orgid_record_in_tbl);
16238 l_customer_tbl(l_rec).FAILURE_SCORE := Get_Element_VALUE('FAILURE_SCORE',l_orgid_record_in_tbl);
16239 l_customer_tbl(l_rec).FAILURE_SCORE_COMMENTARY := Get_Element_VALUE('FAILURE_SCORE_COMMENTARY',l_orgid_record_in_tbl);
16240 l_customer_tbl(l_rec).FAILURE_SCORE_NATL_PERCENTILE := Get_Element_VALUE('FAILURE_SCORE_NATL_PERCENTILE',l_orgid_record_in_tbl);
16241 l_customer_tbl(l_rec).FAILURE_SCORE_OVERRIDE_CODE := Get_Element_VALUE('FAILURE_SCORE_OVERRIDE_CODE',l_orgid_record_in_tbl);
16242 l_customer_tbl(l_rec).GLOBAL_FAILURE_SCORE := Get_Element_VALUE('GLOBAL_FAILURE_SCORE',l_orgid_record_in_tbl);
16243 l_customer_tbl(l_rec).HEADQUARTER_BRANCH_INDICATOR := Get_Element_VALUE('HEADQUARTER_BRANCH_INDICATOR',l_orgid_record_in_tbl);
16244 l_customer_tbl(l_rec).IMPORT_INDICATOR := Get_Element_VALUE('IMPORT_INDICATOR',l_orgid_record_in_tbl);
16245 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS := Get_Element_VALUE('ORGANIZATION_KNOWN_AS',l_orgid_record_in_tbl);
16246 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS2 := Get_Element_VALUE('ORGANIZATION_KNOWN_AS2',l_orgid_record_in_tbl);
16247 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS3 := Get_Element_VALUE('ORGANIZATION_KNOWN_AS3',l_orgid_record_in_tbl);
16248 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS4 := Get_Element_VALUE('ORGANIZATION_KNOWN_AS4',l_orgid_record_in_tbl);
16249 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS5 := Get_Element_VALUE('ORGANIZATION_KNOWN_AS5',l_orgid_record_in_tbl);
16250 l_customer_tbl(l_rec).LABOR_SURPLUS_INDICATOR := Get_Element_VALUE('LABOR_SURPLUS_INDICATOR',l_orgid_record_in_tbl);
16251 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE := Get_Element_VALUE('LOCAL_ACTIVITY_CODE',l_orgid_record_in_tbl);
16252 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE_TYPE := Get_Element_VALUE('LOCAL_ACTIVITY_CODE_TYPE',l_orgid_record_in_tbl);
16253 l_customer_tbl(l_rec).MINORITY_OWNED_INDICATOR := Get_Element_VALUE('MINORITY_OWNED_INDICATOR',l_orgid_record_in_tbl);
16254 l_customer_tbl(l_rec).MINORITY_OWNED_TYPE := Get_Element_VALUE('MINORITY_OWNED_TYPE',l_orgid_record_in_tbl);
16255 l_customer_tbl(l_rec).ORGANIZATION_TYPE := Get_Element_VALUE('ORGANIZATION_TYPE',l_orgid_record_in_tbl);
16256 l_customer_tbl(l_rec).ORGANIZATION_URL := Get_Element_VALUE('ORGANIZATION_URL',l_orgid_record_in_tbl);
16257 l_customer_tbl(l_rec).OUT_OF_BUSINESS_INDICATOR := Get_Element_VALUE('OUT_OF_BUSINESS_INDICATOR',l_orgid_record_in_tbl);
16258 l_customer_tbl(l_rec).PRINCIPAL_NAME := Get_Element_VALUE('PRINCIPAL_NAME',l_orgid_record_in_tbl);
16259 l_customer_tbl(l_rec).PRINCIPAL_TITLE := Get_Element_VALUE('PRINCIPAL_TITLE',l_orgid_record_in_tbl);
16260 l_customer_tbl(l_rec).PUBLIC_PRIVATE_OWNERSHIP_FLAG := Get_Element_VALUE('PUBLIC_PRIVATE_OWNERSHIP_FLAG',l_orgid_record_in_tbl);
16261 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := Get_Element_VALUE('RENT_OWNED_INDICATOR',l_orgid_record_in_tbl);
16262 l_customer_tbl(l_rec).RENT_OWNER_INDICATOR := Get_Element_VALUE('RENT_OWNER_INDICATOR',l_orgid_record_in_tbl);
16263 l_customer_tbl(l_rec).SMALL_BUSINESS_INDICATOR := Get_Element_VALUE('SMALL_BUSINESS_INDICATOR',l_orgid_record_in_tbl);
16264 l_customer_tbl(l_rec).WOMAN_OWNED_INDICATOR := Get_Element_VALUE('WOMAN_OWNED_INDICATOR',l_orgid_record_in_tbl);
16265 l_customer_tbl(l_rec).ORG_ATTRIBUTE_CATEGORY := Get_Element_VALUE('ORG_ATTRIBUTE_CATEGORY',l_orgid_record_in_tbl);
16266 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE1 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE1',l_orgid_record_in_tbl);
16267 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE2 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE2',l_orgid_record_in_tbl);
16268 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE3 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE3',l_orgid_record_in_tbl);
16269 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE4 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE4',l_orgid_record_in_tbl);
16270 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE5 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE5',l_orgid_record_in_tbl);
16271 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE6 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE6',l_orgid_record_in_tbl);
16272 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE7 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE7',l_orgid_record_in_tbl);
16273 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE8 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE8',l_orgid_record_in_tbl);
16274 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE9 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE9',l_orgid_record_in_tbl);
16275 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE10 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE10',l_orgid_record_in_tbl);
16276 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE11 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE11',l_orgid_record_in_tbl);
16277 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE12 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE12',l_orgid_record_in_tbl);
16278 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE13 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE13',l_orgid_record_in_tbl);
16279 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE14 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE14',l_orgid_record_in_tbl);
16280 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE15 := Get_Element_VALUE('ORGANIZATION_ATTRIBUTE15',l_orgid_record_in_tbl);
16281
16282
16283 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := Get_Element_VALUE('VEHICLE_RESPONSE_CODE',l_orgid_record_in_tbl);
16284 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := Get_Element_VALUE('SALES_AGENT_EMAIL_ID',l_orgid_record_in_tbl);
16285 l_customer_tbl(l_rec).NOTES := Get_Element_VALUE('NOTES',l_orgid_record_in_tbl);
16286
16287
16288
16289 /*
16290 -- dbms_output.put_line( ' cust_data_id '||l_customer_tbl(l_rec).cust_data_id);
16291 -- dbms_output.put_line( ' org_imp_xml_element_id '||l_customer_tbl(l_rec).org_imp_xml_element_id);
16292 -- dbms_output.put_line( ' Pat-name '||l_customer_tbl(l_rec).PARTY_NAME);
16293 */
16294 -- Process for location data.
16295 l_loc_element_id := Get_Element_ID('LOCATION',l_orgid_record_in_tbl);
16296 -- dbms_output.put_line( ' l_loc_element_id = '||to_char(l_loc_element_id));
16297
16298 /********* Get all the elements for the location *****************************/
16299 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16300 p_imp_xml_element_id => l_loc_element_id,
16301 x_child_set => l_locid_record_in_tbl,
16302 x_return_status => x_return_status,
16303 x_msg_data => x_msg_data);
16304 -- dbms_output.put_line( ' Location attribute count '||l_locid_record_in_tbl.COUNT);
16305 FOR i IN 1..l_locid_record_in_tbl.COUNT LOOP
16306 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16307 p_imp_xml_element_id => l_locid_record_in_tbl(i).imp_xml_element_id,
16308 x_child_set => l_addid_record_in_tbl,
16309 x_return_status => x_return_status,
16310 x_msg_data => x_msg_data);
16311
16312 l_rec := l_customer_tbl.count;
16313 if i > 1 then
16314 l_rec := l_customer_tbl.count+1;
16315 l_customer_tbl(l_rec).cust_data_id := l_rec;
16316 l_customer_tbl(l_rec).org_imp_xml_element_id := l_customer_tbl(l_rec - 1).org_imp_xml_element_id;
16317 l_customer_tbl(l_rec).party_name := l_customer_tbl(l_rec - 1).party_name;
16318 l_customer_tbl(l_rec).FISCAL_YEAREND_MONTH := l_customer_tbl(l_rec - 1).FISCAL_YEAREND_MONTH;
16319 l_customer_tbl(l_rec).DUNS_NUMBER := l_customer_tbl(l_rec - 1).DUNS_NUMBER;
16320 l_customer_tbl(l_rec).EMPLOYEES_TOTAL := l_customer_tbl(l_rec - 1).EMPLOYEES_TOTAL;
16321 l_customer_tbl(l_rec).LINE_OF_BUSINESS := l_customer_tbl(l_rec - 1).LINE_OF_BUSINESS;
16322 l_customer_tbl(l_rec).YEAR_ESTABLISHED := l_customer_tbl(l_rec - 1).YEAR_ESTABLISHED;
16323 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
16324 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
16325 l_customer_tbl(l_rec).CEO_NAME := l_customer_tbl(l_rec - 1).CEO_NAME;
16326 l_customer_tbl(l_rec).SIC_CODE := l_customer_tbl(l_rec - 1).SIC_CODE;
16327 l_customer_tbl(l_rec).SIC_CODE_TYPE := l_customer_tbl(l_rec - 1).SIC_CODE_TYPE;
16328 l_customer_tbl(l_rec).ANALYSIS_FY := l_customer_tbl(l_rec - 1).ANALYSIS_FY;
16329 l_customer_tbl(l_rec).CURR_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).CURR_FY_POTENTIAL_REVENUE;
16330 l_customer_tbl(l_rec).NEXT_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).NEXT_FY_POTENTIAL_REVENUE;
16331 l_customer_tbl(l_rec).GSA_INDICATOR_FLAG := l_customer_tbl(l_rec - 1).GSA_INDICATOR_FLAG;
16332 l_customer_tbl(l_rec).MISSION_STATEMENT := l_customer_tbl(l_rec - 1).MISSION_STATEMENT;
16333 l_customer_tbl(l_rec).ORGANIZATION_NAME_PHONETIC := l_customer_tbl(l_rec - 1).ORGANIZATION_NAME_PHONETIC;
16334 l_customer_tbl(l_rec).CATEGORY_CODE := l_customer_tbl(l_rec - 1).CATEGORY_CODE;
16335 l_customer_tbl(l_rec).JGZZ_FISCAL_CODE := l_customer_tbl(l_rec - 1).JGZZ_FISCAL_CODE;
16336 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
16337 l_customer_tbl(l_rec).BRANCH_FLAG := l_customer_tbl(l_rec - 1).BRANCH_FLAG;
16338 l_customer_tbl(l_rec).BUSINESS_LINE := l_customer_tbl(l_rec - 1).BUSINESS_LINE;
16339 l_customer_tbl(l_rec).BUSINESS_SCOPE := l_customer_tbl(l_rec - 1).BUSINESS_SCOPE;
16340 l_customer_tbl(l_rec).CHIEF_EXECUTIVE_TITLE := l_customer_tbl(l_rec - 1).CHIEF_EXECUTIVE_TITLE;
16341 l_customer_tbl(l_rec).CONGRESSIONAL_DISTRICT_CODE := l_customer_tbl(l_rec - 1).CONGRESSIONAL_DISTRICT_CODE;
16342 l_customer_tbl(l_rec).CONTROL_YEAR := l_customer_tbl(l_rec - 1).CONTROL_YEAR;
16343 l_customer_tbl(l_rec).CORPORATION_CLASS := l_customer_tbl(l_rec - 1).CORPORATION_CLASS;
16344 l_customer_tbl(l_rec).CREDIT_SCORE := l_customer_tbl(l_rec - 1).CREDIT_SCORE;
16345 l_customer_tbl(l_rec).CREDIT_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).CREDIT_SCORE_COMMENTARY;
16346 l_customer_tbl(l_rec).CUSTOMER_CATEGORY := l_customer_tbl(l_rec - 1).CUSTOMER_CATEGORY;
16347 l_customer_tbl(l_rec).DB_RATING := l_customer_tbl(l_rec - 1).DB_RATING;
16348 l_customer_tbl(l_rec).DEBARMENTS_COUNT := l_customer_tbl(l_rec - 1).DEBARMENTS_COUNT;
16349 l_customer_tbl(l_rec).DEBARTMENTS_DATE := l_customer_tbl(l_rec - 1).DEBARTMENTS_DATE;
16350 l_customer_tbl(l_rec).DEPARTMENT_INDICATOR := l_customer_tbl(l_rec - 1).DEPARTMENT_INDICATOR;
16351 l_customer_tbl(l_rec).DISADVANTAGED_INDICATOR := l_customer_tbl(l_rec - 1).DISADVANTAGED_INDICATOR;
16352 l_customer_tbl(l_rec).ENQUIRY_DUNS := l_customer_tbl(l_rec - 1).ENQUIRY_DUNS;
16353 l_customer_tbl(l_rec).EXPORT_INDICATOR := l_customer_tbl(l_rec - 1).EXPORT_INDICATOR;
16354 l_customer_tbl(l_rec).FAILURE_SCORE := l_customer_tbl(l_rec - 1).FAILURE_SCORE;
16355 l_customer_tbl(l_rec).FAILURE_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).FAILURE_SCORE_COMMENTARY;
16356 l_customer_tbl(l_rec).FAILURE_SCORE_NATL_PERCENTILE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_NATL_PERCENTILE;
16357 l_customer_tbl(l_rec).FAILURE_SCORE_OVERRIDE_CODE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_OVERRIDE_CODE;
16358 l_customer_tbl(l_rec).GLOBAL_FAILURE_SCORE := l_customer_tbl(l_rec - 1).GLOBAL_FAILURE_SCORE;
16359 l_customer_tbl(l_rec).HEADQUARTER_BRANCH_INDICATOR := l_customer_tbl(l_rec - 1).HEADQUARTER_BRANCH_INDICATOR;
16360 l_customer_tbl(l_rec).IMPORT_INDICATOR := l_customer_tbl(l_rec - 1).IMPORT_INDICATOR;
16361 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS;
16362 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS2 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS2;
16363 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS3 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS3;
16364 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS4 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS4;
16365 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS5 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS5;
16366 l_customer_tbl(l_rec).LABOR_SURPLUS_INDICATOR := l_customer_tbl(l_rec - 1).LABOR_SURPLUS_INDICATOR;
16367 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE;
16368 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE_TYPE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE_TYPE;
16369 l_customer_tbl(l_rec).MINORITY_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).MINORITY_OWNED_INDICATOR;
16370 l_customer_tbl(l_rec).MINORITY_OWNED_TYPE := l_customer_tbl(l_rec - 1).MINORITY_OWNED_TYPE;
16371 l_customer_tbl(l_rec).ORGANIZATION_TYPE := l_customer_tbl(l_rec - 1).ORGANIZATION_TYPE;
16372 l_customer_tbl(l_rec).ORGANIZATION_URL := l_customer_tbl(l_rec - 1).ORGANIZATION_URL;
16373 l_customer_tbl(l_rec).OUT_OF_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).OUT_OF_BUSINESS_INDICATOR;
16374 l_customer_tbl(l_rec).PRINCIPAL_NAME := l_customer_tbl(l_rec - 1).PRINCIPAL_NAME;
16375 l_customer_tbl(l_rec).PRINCIPAL_TITLE := l_customer_tbl(l_rec - 1).PRINCIPAL_TITLE;
16376 l_customer_tbl(l_rec).PUBLIC_PRIVATE_OWNERSHIP_FLAG := l_customer_tbl(l_rec - 1).PUBLIC_PRIVATE_OWNERSHIP_FLAG;
16377 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
16378 l_customer_tbl(l_rec).RENT_OWNER_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNER_INDICATOR;
16379 l_customer_tbl(l_rec).SMALL_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).SMALL_BUSINESS_INDICATOR;
16380 l_customer_tbl(l_rec).WOMAN_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).WOMAN_OWNED_INDICATOR;
16381 l_customer_tbl(l_rec).ORG_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ORG_ATTRIBUTE_CATEGORY;
16382 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE1;
16383 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE2;
16384 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE3;
16385 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE4;
16386 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE5;
16387 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE6;
16388 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE7;
16389 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE8;
16390 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE9;
16391 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE10;
16392 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE11;
16393 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE12;
16394 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE13;
16395 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE14;
16396 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE15;
16397 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
16398 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
16399 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
16400 end if;
16401 -- l_customer_tbl(l_rec).add_imp_xml_element_id := l_addid_record_in_tbl(i).imp_xml_element_id;
16402 l_customer_tbl(l_rec).add_imp_xml_element_id := l_locid_record_in_tbl(i).imp_xml_element_id;
16403 l_customer_tbl(l_rec).address1 := Get_Element_VALUE('ADDRESS1',l_addid_record_in_tbl);
16404 l_customer_tbl(l_rec).address2 := Get_Element_VALUE('ADDRESS2',l_addid_record_in_tbl);
16405 l_customer_tbl(l_rec).address3 := Get_Element_VALUE('ADDRESS3',l_addid_record_in_tbl);
16406 l_customer_tbl(l_rec).address4 := Get_Element_VALUE('ADDRESS4',l_addid_record_in_tbl);
16407 l_customer_tbl(l_rec).CITY := Get_Element_VALUE('CITY',l_addid_record_in_tbl);
16408 l_customer_tbl(l_rec).COUNTY := Get_Element_VALUE('COUNTY',l_addid_record_in_tbl);
16409 l_customer_tbl(l_rec).PROVINCE := Get_Element_VALUE('PROVINCE',l_addid_record_in_tbl);
16410 l_customer_tbl(l_rec).STATE := Get_Element_VALUE('STATE',l_addid_record_in_tbl);
16411 l_customer_tbl(l_rec).POSTAL_CODE := Get_Element_VALUE('POSTAL_CODE',l_addid_record_in_tbl);
16412 l_customer_tbl(l_rec).COUNTRY := Get_Element_VALUE('COUNTRY',l_addid_record_in_tbl);
16413 l_customer_tbl(l_rec).ADDRESS_LINES_PHONETIC := Get_Element_VALUE('ADDRESS_LINES_PHONETIC',l_addid_record_in_tbl);
16414 -- bug 4641591: columns obsolete
16415 -- l_customer_tbl(l_rec).PO_BOX_NUMBER := Get_Element_VALUE('PO_BOX_NUMBER',l_addid_record_in_tbl);
16416 -- l_customer_tbl(l_rec).HOUSE_NUMBER := Get_Element_VALUE('HOUSE_NUMBER',l_addid_record_in_tbl);
16417 -- l_customer_tbl(l_rec).STREET_SUFFIX := Get_Element_VALUE('STREET_SUFFIX',l_addid_record_in_tbl);
16418 -- l_customer_tbl(l_rec).STREET := Get_Element_VALUE('STREET',l_addid_record_in_tbl);
16419 -- l_customer_tbl(l_rec).STREET_NUMBER := Get_Element_VALUE('STREET_NUMBER',l_addid_record_in_tbl);
16420 -- l_customer_tbl(l_rec).FLOOR := Get_Element_VALUE('FLOOR',l_addid_record_in_tbl);
16421 -- l_customer_tbl(l_rec).SUITE := Get_Element_VALUE('SUITE',l_addid_record_in_tbl);
16422 l_customer_tbl(l_rec).POSTAL_PLUS4_CODE := Get_Element_VALUE('POSTAL_PLUS4_CODE',l_addid_record_in_tbl);
16423 l_customer_tbl(l_rec).IDENTIFYING_ADDRESS_FLAG := Get_Element_VALUE('IDENTIFYING_ADDRESS_FLAG',l_addid_record_in_tbl);
16424 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := Get_Element_VALUE('ADDRESS_ATTRIBUTE1',l_addid_record_in_tbl);
16425 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := Get_Element_VALUE('ADDRESS_ATTRIBUTE2',l_addid_record_in_tbl);
16426 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := Get_Element_VALUE('ADDRESS_ATTRIBUTE3',l_addid_record_in_tbl);
16427 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := Get_Element_VALUE('ADDRESS_ATTRIBUTE4',l_addid_record_in_tbl);
16428 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := Get_Element_VALUE('ADDRESS_ATTRIBUTE5',l_addid_record_in_tbl);
16429 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := Get_Element_VALUE('ADDRESS_ATTRIBUTE6',l_addid_record_in_tbl);
16430 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := Get_Element_VALUE('ADDRESS_ATTRIBUTE7',l_addid_record_in_tbl);
16431 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := Get_Element_VALUE('ADDRESS_ATTRIBUTE8',l_addid_record_in_tbl);
16432 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := Get_Element_VALUE('ADDRESS_ATTRIBUTE9',l_addid_record_in_tbl);
16433 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := Get_Element_VALUE('ADDRESS_ATTRIBUTE10',l_addid_record_in_tbl);
16434 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := Get_Element_VALUE('ADDRESS_ATTRIBUTE11',l_addid_record_in_tbl);
16435 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := Get_Element_VALUE('ADDRESS_ATTRIBUTE12',l_addid_record_in_tbl);
16436 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := Get_Element_VALUE('ADDRESS_ATTRIBUTE13',l_addid_record_in_tbl);
16437 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := Get_Element_VALUE('ADDRESS_ATTRIBUTE14',l_addid_record_in_tbl);
16438 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := Get_Element_VALUE('ADDRESS_ATTRIBUTE15',l_addid_record_in_tbl);
16439 l_customer_tbl(l_rec).DESCRIPTION := Get_Element_VALUE('DESCRIPTION',l_addid_record_in_tbl);
16440 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := Get_Element_VALUE('ADDRESS_ATTRIBUTE_CATEGORY',l_addid_record_in_tbl);
16441 l_customer_tbl(l_rec).PARTY_SITE_USE := Get_Element_VALUE('PARTY_SITE_USE',l_addid_record_in_tbl);
16442 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := Get_Element_VALUE('LOCATION_DIRECTIONS',l_addid_record_in_tbl);
16443 l_customer_tbl(l_rec).SHORT_DESCRIPTION := Get_Element_VALUE('SHORT_DESCRIPTION',l_addid_record_in_tbl);
16444 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := Get_Element_VALUE('ADDRESS_EFFECTIVE_DATE',l_addid_record_in_tbl);
16445 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := Get_Element_VALUE('ADDRESS_EXPIRATION_DATE',l_addid_record_in_tbl);
16446
16447 l_rec := 0;
16448 -- ****************************** End Location process
16449
16450 -- Process for Org Contact data.
16451 l_oct_element_id := Get_Element_ID('ORG_CONTACT',l_addid_record_in_tbl);
16452 -- dbms_output.put_line( ' l_oct_element_id = '||to_char(l_oct_element_id));
16453
16454 /********* Get all the elements for Org Contact *****************************/
16455 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16456 p_imp_xml_element_id => l_oct_element_id,
16457 x_child_set => l_octid_record_in_tbl,
16458 x_return_status => x_return_status,
16459 x_msg_data => x_msg_data);
16460 -- dbms_output.put_line( ' Org Con attribute count '||l_octid_record_in_tbl.COUNT);
16461 FOR j IN 1..l_octid_record_in_tbl.COUNT LOOP
16462 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16463 p_imp_xml_element_id => l_octid_record_in_tbl(j).imp_xml_element_id,
16464 x_child_set => l_conid_record_in_tbl,
16465 x_return_status => x_return_status,
16466 x_msg_data => x_msg_data);
16467
16468 l_rec := l_customer_tbl.count;
16469 if j > 1 then
16470 l_rec := l_customer_tbl.count+1;
16471 l_customer_tbl(l_rec).cust_data_id := l_rec;
16472 l_customer_tbl(l_rec).org_imp_xml_element_id := l_customer_tbl(l_rec - 1).org_imp_xml_element_id;
16473 l_customer_tbl(l_rec).party_name := l_customer_tbl(l_rec - 1).party_name;
16474 l_customer_tbl(l_rec).FISCAL_YEAREND_MONTH := l_customer_tbl(l_rec - 1).FISCAL_YEAREND_MONTH;
16475 l_customer_tbl(l_rec).DUNS_NUMBER := l_customer_tbl(l_rec - 1).DUNS_NUMBER;
16476 l_customer_tbl(l_rec).EMPLOYEES_TOTAL := l_customer_tbl(l_rec - 1).EMPLOYEES_TOTAL;
16477 l_customer_tbl(l_rec).LINE_OF_BUSINESS := l_customer_tbl(l_rec - 1).LINE_OF_BUSINESS;
16478 l_customer_tbl(l_rec).YEAR_ESTABLISHED := l_customer_tbl(l_rec - 1).YEAR_ESTABLISHED;
16479 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
16480 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
16481 l_customer_tbl(l_rec).CEO_NAME := l_customer_tbl(l_rec - 1).CEO_NAME;
16482 l_customer_tbl(l_rec).SIC_CODE := l_customer_tbl(l_rec - 1).SIC_CODE;
16483 l_customer_tbl(l_rec).SIC_CODE_TYPE := l_customer_tbl(l_rec - 1).SIC_CODE_TYPE;
16484 l_customer_tbl(l_rec).ANALYSIS_FY := l_customer_tbl(l_rec - 1).ANALYSIS_FY;
16485 l_customer_tbl(l_rec).CURR_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).CURR_FY_POTENTIAL_REVENUE;
16486 l_customer_tbl(l_rec).NEXT_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).NEXT_FY_POTENTIAL_REVENUE;
16487 l_customer_tbl(l_rec).GSA_INDICATOR_FLAG := l_customer_tbl(l_rec - 1).GSA_INDICATOR_FLAG;
16488 l_customer_tbl(l_rec).MISSION_STATEMENT := l_customer_tbl(l_rec - 1).MISSION_STATEMENT;
16489 l_customer_tbl(l_rec).ORGANIZATION_NAME_PHONETIC := l_customer_tbl(l_rec - 1).ORGANIZATION_NAME_PHONETIC;
16490 l_customer_tbl(l_rec).CATEGORY_CODE := l_customer_tbl(l_rec - 1).CATEGORY_CODE;
16491 l_customer_tbl(l_rec).JGZZ_FISCAL_CODE := l_customer_tbl(l_rec - 1).JGZZ_FISCAL_CODE;
16492 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
16493 l_customer_tbl(l_rec).BRANCH_FLAG := l_customer_tbl(l_rec - 1).BRANCH_FLAG;
16494 l_customer_tbl(l_rec).BUSINESS_LINE := l_customer_tbl(l_rec - 1).BUSINESS_LINE;
16495 l_customer_tbl(l_rec).BUSINESS_SCOPE := l_customer_tbl(l_rec - 1).BUSINESS_SCOPE;
16496 l_customer_tbl(l_rec).CHIEF_EXECUTIVE_TITLE := l_customer_tbl(l_rec - 1).CHIEF_EXECUTIVE_TITLE;
16497 l_customer_tbl(l_rec).CONGRESSIONAL_DISTRICT_CODE := l_customer_tbl(l_rec - 1).CONGRESSIONAL_DISTRICT_CODE;
16498 l_customer_tbl(l_rec).CONTROL_YEAR := l_customer_tbl(l_rec - 1).CONTROL_YEAR;
16499 l_customer_tbl(l_rec).CORPORATION_CLASS := l_customer_tbl(l_rec - 1).CORPORATION_CLASS;
16500 l_customer_tbl(l_rec).CREDIT_SCORE := l_customer_tbl(l_rec - 1).CREDIT_SCORE;
16501 l_customer_tbl(l_rec).CREDIT_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).CREDIT_SCORE_COMMENTARY;
16502 l_customer_tbl(l_rec).CUSTOMER_CATEGORY := l_customer_tbl(l_rec - 1).CUSTOMER_CATEGORY;
16503 l_customer_tbl(l_rec).DB_RATING := l_customer_tbl(l_rec - 1).DB_RATING;
16504 l_customer_tbl(l_rec).DEBARMENTS_COUNT := l_customer_tbl(l_rec - 1).DEBARMENTS_COUNT;
16505 l_customer_tbl(l_rec).DEBARTMENTS_DATE := l_customer_tbl(l_rec - 1).DEBARTMENTS_DATE;
16506 l_customer_tbl(l_rec).DEPARTMENT_INDICATOR := l_customer_tbl(l_rec - 1).DEPARTMENT_INDICATOR;
16507 l_customer_tbl(l_rec).DISADVANTAGED_INDICATOR := l_customer_tbl(l_rec - 1).DISADVANTAGED_INDICATOR;
16508 l_customer_tbl(l_rec).ENQUIRY_DUNS := l_customer_tbl(l_rec - 1).ENQUIRY_DUNS;
16509 l_customer_tbl(l_rec).EXPORT_INDICATOR := l_customer_tbl(l_rec - 1).EXPORT_INDICATOR;
16510 l_customer_tbl(l_rec).FAILURE_SCORE := l_customer_tbl(l_rec - 1).FAILURE_SCORE;
16511 l_customer_tbl(l_rec).FAILURE_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).FAILURE_SCORE_COMMENTARY;
16512 l_customer_tbl(l_rec).FAILURE_SCORE_NATL_PERCENTILE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_NATL_PERCENTILE;
16513 l_customer_tbl(l_rec).FAILURE_SCORE_OVERRIDE_CODE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_OVERRIDE_CODE;
16514 l_customer_tbl(l_rec).GLOBAL_FAILURE_SCORE := l_customer_tbl(l_rec - 1).GLOBAL_FAILURE_SCORE;
16515 l_customer_tbl(l_rec).HEADQUARTER_BRANCH_INDICATOR := l_customer_tbl(l_rec - 1).HEADQUARTER_BRANCH_INDICATOR;
16516 l_customer_tbl(l_rec).IMPORT_INDICATOR := l_customer_tbl(l_rec - 1).IMPORT_INDICATOR;
16517 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS;
16518 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS2 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS2;
16519 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS3 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS3;
16520 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS4 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS4;
16521 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS5 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS5;
16522 l_customer_tbl(l_rec).LABOR_SURPLUS_INDICATOR := l_customer_tbl(l_rec - 1).LABOR_SURPLUS_INDICATOR;
16523 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE;
16524 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE_TYPE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE_TYPE;
16525 l_customer_tbl(l_rec).MINORITY_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).MINORITY_OWNED_INDICATOR;
16526 l_customer_tbl(l_rec).MINORITY_OWNED_TYPE := l_customer_tbl(l_rec - 1).MINORITY_OWNED_TYPE;
16527 l_customer_tbl(l_rec).ORGANIZATION_TYPE := l_customer_tbl(l_rec - 1).ORGANIZATION_TYPE;
16528 l_customer_tbl(l_rec).ORGANIZATION_URL := l_customer_tbl(l_rec - 1).ORGANIZATION_URL;
16529 l_customer_tbl(l_rec).OUT_OF_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).OUT_OF_BUSINESS_INDICATOR;
16530 l_customer_tbl(l_rec).PRINCIPAL_NAME := l_customer_tbl(l_rec - 1).PRINCIPAL_NAME;
16531 l_customer_tbl(l_rec).PRINCIPAL_TITLE := l_customer_tbl(l_rec - 1).PRINCIPAL_TITLE;
16532 l_customer_tbl(l_rec).PUBLIC_PRIVATE_OWNERSHIP_FLAG := l_customer_tbl(l_rec - 1).PUBLIC_PRIVATE_OWNERSHIP_FLAG;
16533 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
16534 l_customer_tbl(l_rec).RENT_OWNER_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNER_INDICATOR;
16535 l_customer_tbl(l_rec).SMALL_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).SMALL_BUSINESS_INDICATOR;
16536 l_customer_tbl(l_rec).WOMAN_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).WOMAN_OWNED_INDICATOR;
16537 l_customer_tbl(l_rec).ORG_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ORG_ATTRIBUTE_CATEGORY;
16538 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE1;
16539 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE2;
16540 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE3;
16541 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE4;
16542 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE5;
16543 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE6;
16544 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE7;
16545 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE8;
16546 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE9;
16547 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE10;
16548 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE11;
16549 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE12;
16550 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE13;
16551 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE14;
16552 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE15;
16553 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
16554 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
16555 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
16556
16557
16558
16559 l_customer_tbl(l_rec).add_imp_xml_element_id := l_customer_tbl(l_rec - 1).add_imp_xml_element_id;
16560 l_customer_tbl(l_rec).address1 := l_customer_tbl(l_rec - 1).address1;
16561 l_customer_tbl(l_rec).address2 := l_customer_tbl(l_rec - 1).address2;
16562 l_customer_tbl(l_rec).address3 := l_customer_tbl(l_rec - 1).address3;
16563 l_customer_tbl(l_rec).address4 := l_customer_tbl(l_rec - 1).address4;
16564 l_customer_tbl(l_rec).city := l_customer_tbl(l_rec - 1).city;
16565 l_customer_tbl(l_rec).county := l_customer_tbl(l_rec - 1).county;
16566 l_customer_tbl(l_rec).province := l_customer_tbl(l_rec - 1).province;
16567 l_customer_tbl(l_rec).state := l_customer_tbl(l_rec - 1).state;
16568 l_customer_tbl(l_rec).postal_code := l_customer_tbl(l_rec - 1).postal_code;
16569 l_customer_tbl(l_rec).country := l_customer_tbl(l_rec - 1).country;
16570 l_customer_tbl(l_rec).address_lines_phonetic := l_customer_tbl(l_rec - 1).address_lines_phonetic;
16571 -- bug 4641591: columns obsolete
16572 -- l_customer_tbl(l_rec).po_box_number := l_customer_tbl(l_rec - 1).po_box_number;
16573 -- l_customer_tbl(l_rec).house_number := l_customer_tbl(l_rec - 1).house_number;
16574 -- l_customer_tbl(l_rec).street_suffix := l_customer_tbl(l_rec - 1).street_suffix;
16575 -- l_customer_tbl(l_rec).street := l_customer_tbl(l_rec - 1).street;
16576 -- l_customer_tbl(l_rec).street_number := l_customer_tbl(l_rec - 1).street_number;
16577 -- l_customer_tbl(l_rec).floor := l_customer_tbl(l_rec - 1).floor;
16578 -- l_customer_tbl(l_rec).suite := l_customer_tbl(l_rec - 1).suite;
16579 l_customer_tbl(l_rec).postal_plus4_code := l_customer_tbl(l_rec - 1).postal_plus4_code;
16580 l_customer_tbl(l_rec).identifying_address_flag := l_customer_tbl(l_rec - 1).identifying_address_flag;
16581
16582 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE1;
16583 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE2;
16584 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE3;
16585 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE4;
16586 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE5;
16587 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE6;
16588 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE7;
16589 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE8;
16590 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE9;
16591 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE10;
16592 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE11;
16593 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE12;
16594 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE13;
16595 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE14;
16596 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE15;
16597 l_customer_tbl(l_rec).DESCRIPTION := l_customer_tbl(l_rec - 1).DESCRIPTION;
16598 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE_CATEGORY;
16599 l_customer_tbl(l_rec).PARTY_SITE_USE := l_customer_tbl(l_rec - 1).PARTY_SITE_USE;
16600 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := l_customer_tbl(l_rec - 1).LOCATION_DIRECTIONS;
16601 l_customer_tbl(l_rec).SHORT_DESCRIPTION := l_customer_tbl(l_rec - 1).SHORT_DESCRIPTION;
16602 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EFFECTIVE_DATE;
16603 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EXPIRATION_DATE;
16604
16605 end if;
16606 -- l_customer_tbl(l_rec).ocont_imp_xml_element_id := l_conid_record_in_tbl(i).imp_xml_element_id;
16607 l_customer_tbl(l_rec).ocont_imp_xml_element_id := l_octid_record_in_tbl(j).imp_xml_element_id;
16608 l_customer_tbl(l_rec).person_first_name := Get_Element_VALUE('PERSON_FIRST_NAME',l_conid_record_in_tbl);
16609 l_customer_tbl(l_rec).person_last_name := Get_Element_VALUE('PERSON_LAST_NAME',l_conid_record_in_tbl);
16610 l_customer_tbl(l_rec).person_middle_name := Get_Element_VALUE('PERSON_MIDDLE_NAME',l_conid_record_in_tbl);
16611 l_customer_tbl(l_rec).person_name_suffix := Get_Element_VALUE('PERSON_NAME_SUFFIX',l_conid_record_in_tbl);
16612 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := Get_Element_VALUE('PERSON_NAME_PREFIX',l_conid_record_in_tbl);
16613 l_customer_tbl(l_rec).department := Get_Element_VALUE('DEPARTMENT',l_conid_record_in_tbl);
16614 l_customer_tbl(l_rec).job_title := Get_Element_VALUE('JOB_TITLE',l_conid_record_in_tbl);
16615 l_customer_tbl(l_rec).decision_maker_flag := Get_Element_VALUE('DECISION_MAKER_FLAG',l_conid_record_in_tbl);
16616
16617
16618
16619 l_customer_tbl(l_rec).PERSONAL_INCOME := Get_Element_VALUE('PERSONAL_INCOME',l_conid_record_in_tbl);
16620 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := Get_Element_VALUE('PERSON_ACADEMIC_TITLE',l_conid_record_in_tbl);
16621 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := Get_Element_VALUE('PERSON_FIRST_NAME_PHONETIC',l_conid_record_in_tbl);
16622 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := Get_Element_VALUE('PERSON_LAST_NAME_PHONETIC',l_conid_record_in_tbl);
16623 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := Get_Element_VALUE('MIDDLE_NAME_PHONETIC',l_conid_record_in_tbl);
16624 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := Get_Element_VALUE('PERSON_NAME_PHONETIC',l_conid_record_in_tbl);
16625 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := Get_Element_VALUE('PERSON_PREVIOUS_TITLE_NAME',l_conid_record_in_tbl);
16626 l_customer_tbl(l_rec).PLACE_OF_BIRTH := Get_Element_VALUE('PLACE_OF_BIRTH',l_conid_record_in_tbl);
16627 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := Get_Element_VALUE('HEAD_OF_HOUSEHOLD_FLAG',l_conid_record_in_tbl);
16628 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := Get_Element_VALUE('HOUSEHOLD_SIZE',l_conid_record_in_tbl);
16629 l_customer_tbl(l_rec).TAX_ID := Get_Element_VALUE('TAX_ID',l_conid_record_in_tbl);
16630 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE_CATEGORY := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE_CATEGORY',l_conid_record_in_tbl);
16631 l_customer_tbl(l_rec).DATE_OF_BIRTH := Get_Element_VALUE('DATE_OF_BIRTH',l_conid_record_in_tbl);
16632 l_customer_tbl(l_rec).DATE_OF_DEATH := Get_Element_VALUE('DATE_OF_DEATH',l_conid_record_in_tbl);
16633 l_customer_tbl(l_rec).DECLARED_ETHNICITY := Get_Element_VALUE('DECLARED_ETHNICITY',l_conid_record_in_tbl);
16634 l_customer_tbl(l_rec).MARITAL_STATUS := Get_Element_VALUE('MARITAL_STATUS',l_conid_record_in_tbl);
16635 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := Get_Element_VALUE('MARITAL_STATUS_EFFECTIVE_DATE',l_conid_record_in_tbl);
16636 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE1 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE1',l_conid_record_in_tbl);
16637 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE2 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE2',l_conid_record_in_tbl);
16638 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE3 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE3',l_conid_record_in_tbl);
16639 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE4 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE4',l_conid_record_in_tbl);
16640 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE5 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE5',l_conid_record_in_tbl);
16641 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE6 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE6',l_conid_record_in_tbl);
16642 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE7 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE7',l_conid_record_in_tbl);
16643 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE8 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE8',l_conid_record_in_tbl);
16644 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE9 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE9',l_conid_record_in_tbl);
16645 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE10 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE10',l_conid_record_in_tbl);
16646 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE11 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE11',l_conid_record_in_tbl);
16647 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE12 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE12',l_conid_record_in_tbl);
16648 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE13 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE13',l_conid_record_in_tbl);
16649 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE14 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE14',l_conid_record_in_tbl);
16650 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE15 := Get_Element_VALUE('ORG_CONTACT_ATTRIBUTE15',l_conid_record_in_tbl);
16651
16652 l_rec := 0;
16653
16654
16655 -- Process of Phone data.
16656 l_pho_element_id := Get_Element_ID('PHONE',l_conid_record_in_tbl);
16657 -- dbms_output.put_line( ' l_pho_element_id = '||to_char(l_pho_element_id));
16658
16659 /********* Get all the elements for phone *****************************/
16660 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16661 p_imp_xml_element_id => l_pho_element_id,
16662 x_child_set => l_phoid_record_in_tbl,
16663 x_return_status => x_return_status,
16664 x_msg_data => x_msg_data);
16665 -- dbms_output.put_line( ' Phone attribute count '||l_phoid_record_in_tbl.COUNT);
16666 FOR k IN 1..l_phoid_record_in_tbl.COUNT LOOP
16667 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16668 p_imp_xml_element_id => l_phoid_record_in_tbl(k).imp_xml_element_id,
16669 x_child_set => l_phiid_record_in_tbl,
16670 x_return_status => x_return_status,
16671 x_msg_data => x_msg_data);
16672
16673 l_rec := l_customer_tbl.count;
16674 if k > 1 then
16675 l_rec := l_customer_tbl.count+1;
16676 l_customer_tbl(l_rec).cust_data_id := l_rec;
16677 l_customer_tbl(l_rec).org_imp_xml_element_id := l_customer_tbl(l_rec - 1).org_imp_xml_element_id;
16678 l_customer_tbl(l_rec).party_name := l_customer_tbl(l_rec - 1).party_name;
16679 l_customer_tbl(l_rec).FISCAL_YEAREND_MONTH := l_customer_tbl(l_rec - 1).FISCAL_YEAREND_MONTH;
16680 l_customer_tbl(l_rec).DUNS_NUMBER := l_customer_tbl(l_rec - 1).DUNS_NUMBER;
16681 l_customer_tbl(l_rec).EMPLOYEES_TOTAL := l_customer_tbl(l_rec - 1).EMPLOYEES_TOTAL;
16682 l_customer_tbl(l_rec).LINE_OF_BUSINESS := l_customer_tbl(l_rec - 1).LINE_OF_BUSINESS;
16683 l_customer_tbl(l_rec).YEAR_ESTABLISHED := l_customer_tbl(l_rec - 1).YEAR_ESTABLISHED;
16684 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
16685 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
16686 l_customer_tbl(l_rec).CEO_NAME := l_customer_tbl(l_rec - 1).CEO_NAME;
16687 l_customer_tbl(l_rec).SIC_CODE := l_customer_tbl(l_rec - 1).SIC_CODE;
16688 l_customer_tbl(l_rec).SIC_CODE_TYPE := l_customer_tbl(l_rec - 1).SIC_CODE_TYPE;
16689 l_customer_tbl(l_rec).ANALYSIS_FY := l_customer_tbl(l_rec - 1).ANALYSIS_FY;
16690 l_customer_tbl(l_rec).CURR_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).CURR_FY_POTENTIAL_REVENUE;
16691 l_customer_tbl(l_rec).NEXT_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).NEXT_FY_POTENTIAL_REVENUE;
16692 l_customer_tbl(l_rec).GSA_INDICATOR_FLAG := l_customer_tbl(l_rec - 1).GSA_INDICATOR_FLAG;
16693 l_customer_tbl(l_rec).MISSION_STATEMENT := l_customer_tbl(l_rec - 1).MISSION_STATEMENT;
16694 l_customer_tbl(l_rec).ORGANIZATION_NAME_PHONETIC := l_customer_tbl(l_rec - 1).ORGANIZATION_NAME_PHONETIC;
16695 l_customer_tbl(l_rec).CATEGORY_CODE := l_customer_tbl(l_rec - 1).CATEGORY_CODE;
16696 l_customer_tbl(l_rec).JGZZ_FISCAL_CODE := l_customer_tbl(l_rec - 1).JGZZ_FISCAL_CODE;
16697 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
16698 l_customer_tbl(l_rec).BRANCH_FLAG := l_customer_tbl(l_rec - 1).BRANCH_FLAG;
16699 l_customer_tbl(l_rec).BUSINESS_LINE := l_customer_tbl(l_rec - 1).BUSINESS_LINE;
16700 l_customer_tbl(l_rec).BUSINESS_SCOPE := l_customer_tbl(l_rec - 1).BUSINESS_SCOPE;
16701 l_customer_tbl(l_rec).CHIEF_EXECUTIVE_TITLE := l_customer_tbl(l_rec - 1).CHIEF_EXECUTIVE_TITLE;
16702 l_customer_tbl(l_rec).CONGRESSIONAL_DISTRICT_CODE := l_customer_tbl(l_rec - 1).CONGRESSIONAL_DISTRICT_CODE;
16703 l_customer_tbl(l_rec).CONTROL_YEAR := l_customer_tbl(l_rec - 1).CONTROL_YEAR;
16704 l_customer_tbl(l_rec).CORPORATION_CLASS := l_customer_tbl(l_rec - 1).CORPORATION_CLASS;
16705 l_customer_tbl(l_rec).CREDIT_SCORE := l_customer_tbl(l_rec - 1).CREDIT_SCORE;
16706 l_customer_tbl(l_rec).CREDIT_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).CREDIT_SCORE_COMMENTARY;
16707 l_customer_tbl(l_rec).CUSTOMER_CATEGORY := l_customer_tbl(l_rec - 1).CUSTOMER_CATEGORY;
16708 l_customer_tbl(l_rec).DB_RATING := l_customer_tbl(l_rec - 1).DB_RATING;
16709 l_customer_tbl(l_rec).DEBARMENTS_COUNT := l_customer_tbl(l_rec - 1).DEBARMENTS_COUNT;
16710 l_customer_tbl(l_rec).DEBARTMENTS_DATE := l_customer_tbl(l_rec - 1).DEBARTMENTS_DATE;
16711 l_customer_tbl(l_rec).DEPARTMENT_INDICATOR := l_customer_tbl(l_rec - 1).DEPARTMENT_INDICATOR;
16712 l_customer_tbl(l_rec).DISADVANTAGED_INDICATOR := l_customer_tbl(l_rec - 1).DISADVANTAGED_INDICATOR;
16713 l_customer_tbl(l_rec).ENQUIRY_DUNS := l_customer_tbl(l_rec - 1).ENQUIRY_DUNS;
16714 l_customer_tbl(l_rec).EXPORT_INDICATOR := l_customer_tbl(l_rec - 1).EXPORT_INDICATOR;
16715 l_customer_tbl(l_rec).FAILURE_SCORE := l_customer_tbl(l_rec - 1).FAILURE_SCORE;
16716 l_customer_tbl(l_rec).FAILURE_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).FAILURE_SCORE_COMMENTARY;
16717 l_customer_tbl(l_rec).FAILURE_SCORE_NATL_PERCENTILE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_NATL_PERCENTILE;
16718 l_customer_tbl(l_rec).FAILURE_SCORE_OVERRIDE_CODE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_OVERRIDE_CODE;
16719 l_customer_tbl(l_rec).GLOBAL_FAILURE_SCORE := l_customer_tbl(l_rec - 1).GLOBAL_FAILURE_SCORE;
16720 l_customer_tbl(l_rec).HEADQUARTER_BRANCH_INDICATOR := l_customer_tbl(l_rec - 1).HEADQUARTER_BRANCH_INDICATOR;
16721 l_customer_tbl(l_rec).IMPORT_INDICATOR := l_customer_tbl(l_rec - 1).IMPORT_INDICATOR;
16722 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS;
16723 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS2 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS2;
16724 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS3 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS3;
16725 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS4 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS4;
16726 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS5 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS5;
16727 l_customer_tbl(l_rec).LABOR_SURPLUS_INDICATOR := l_customer_tbl(l_rec - 1).LABOR_SURPLUS_INDICATOR;
16728 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE;
16729 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE_TYPE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE_TYPE;
16730 l_customer_tbl(l_rec).MINORITY_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).MINORITY_OWNED_INDICATOR;
16731 l_customer_tbl(l_rec).MINORITY_OWNED_TYPE := l_customer_tbl(l_rec - 1).MINORITY_OWNED_TYPE;
16732 l_customer_tbl(l_rec).ORGANIZATION_TYPE := l_customer_tbl(l_rec - 1).ORGANIZATION_TYPE;
16733 l_customer_tbl(l_rec).ORGANIZATION_URL := l_customer_tbl(l_rec - 1).ORGANIZATION_URL;
16734 l_customer_tbl(l_rec).OUT_OF_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).OUT_OF_BUSINESS_INDICATOR;
16735 l_customer_tbl(l_rec).PRINCIPAL_NAME := l_customer_tbl(l_rec - 1).PRINCIPAL_NAME;
16736 l_customer_tbl(l_rec).PRINCIPAL_TITLE := l_customer_tbl(l_rec - 1).PRINCIPAL_TITLE;
16737 l_customer_tbl(l_rec).PUBLIC_PRIVATE_OWNERSHIP_FLAG := l_customer_tbl(l_rec - 1).PUBLIC_PRIVATE_OWNERSHIP_FLAG;
16738 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
16739 l_customer_tbl(l_rec).RENT_OWNER_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNER_INDICATOR;
16740 l_customer_tbl(l_rec).SMALL_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).SMALL_BUSINESS_INDICATOR;
16741 l_customer_tbl(l_rec).WOMAN_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).WOMAN_OWNED_INDICATOR;
16742 l_customer_tbl(l_rec).ORG_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ORG_ATTRIBUTE_CATEGORY;
16743 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE1;
16744 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE2;
16745 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE3;
16746 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE4;
16747 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE5;
16748 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE6;
16749 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE7;
16750 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE8;
16751 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE9;
16752 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE10;
16753 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE11;
16754 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE12;
16755 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE13;
16756 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE14;
16757 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE15;
16758 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
16759 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
16760 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
16761
16762
16763
16764 l_customer_tbl(l_rec).add_imp_xml_element_id := l_customer_tbl(l_rec - 1).add_imp_xml_element_id;
16765 l_customer_tbl(l_rec).address1 := l_customer_tbl(l_rec - 1).address1;
16766 l_customer_tbl(l_rec).address2 := l_customer_tbl(l_rec - 1).address2;
16767 l_customer_tbl(l_rec).address3 := l_customer_tbl(l_rec - 1).address3;
16768 l_customer_tbl(l_rec).address4 := l_customer_tbl(l_rec - 1).address4;
16769 l_customer_tbl(l_rec).city := l_customer_tbl(l_rec - 1).city;
16770 l_customer_tbl(l_rec).county := l_customer_tbl(l_rec - 1).county;
16771 l_customer_tbl(l_rec).province := l_customer_tbl(l_rec - 1).province;
16772 l_customer_tbl(l_rec).state := l_customer_tbl(l_rec - 1).state;
16773 l_customer_tbl(l_rec).postal_code := l_customer_tbl(l_rec - 1).postal_code;
16774 l_customer_tbl(l_rec).country := l_customer_tbl(l_rec - 1).country;
16775 l_customer_tbl(l_rec).address_lines_phonetic := l_customer_tbl(l_rec - 1).address_lines_phonetic;
16776 -- bug 4641591: columns obsolete
16777 -- l_customer_tbl(l_rec).po_box_number := l_customer_tbl(l_rec - 1).po_box_number;
16778 -- l_customer_tbl(l_rec).house_number := l_customer_tbl(l_rec - 1).house_number;
16779 -- l_customer_tbl(l_rec).street_suffix := l_customer_tbl(l_rec - 1).street_suffix;
16780 -- l_customer_tbl(l_rec).street := l_customer_tbl(l_rec - 1).street;
16781 -- l_customer_tbl(l_rec).street_number := l_customer_tbl(l_rec - 1).street_number;
16782 -- l_customer_tbl(l_rec).floor := l_customer_tbl(l_rec - 1).floor;
16783 -- l_customer_tbl(l_rec).suite := l_customer_tbl(l_rec - 1).suite;
16784 l_customer_tbl(l_rec).postal_plus4_code := l_customer_tbl(l_rec - 1).postal_plus4_code;
16785 l_customer_tbl(l_rec).identifying_address_flag := l_customer_tbl(l_rec - 1).identifying_address_flag;
16786 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE1;
16787 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE2;
16788 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE3;
16789 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE4;
16790 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE5;
16791 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE6;
16792 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE7;
16793 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE8;
16794 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE9;
16795 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE10;
16796 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE11;
16797 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE12;
16798 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE13;
16799 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE14;
16800 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE15;
16801 l_customer_tbl(l_rec).DESCRIPTION := l_customer_tbl(l_rec - 1).DESCRIPTION;
16802 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE_CATEGORY;
16803 l_customer_tbl(l_rec).PARTY_SITE_USE := l_customer_tbl(l_rec - 1).PARTY_SITE_USE;
16804 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := l_customer_tbl(l_rec - 1).LOCATION_DIRECTIONS;
16805 l_customer_tbl(l_rec).SHORT_DESCRIPTION := l_customer_tbl(l_rec - 1).SHORT_DESCRIPTION;
16806 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EFFECTIVE_DATE;
16807 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EXPIRATION_DATE;
16808
16809
16810 l_customer_tbl(l_rec).ocont_imp_xml_element_id := l_customer_tbl(l_rec - 1).ocont_imp_xml_element_id;
16811 l_customer_tbl(l_rec).person_first_name := l_customer_tbl(l_rec - 1).person_first_name;
16812 l_customer_tbl(l_rec).person_middle_name := l_customer_tbl(l_rec - 1).person_middle_name;
16813 l_customer_tbl(l_rec).person_name_suffix := l_customer_tbl(l_rec - 1).person_name_suffix;
16814 l_customer_tbl(l_rec).person_last_name := l_customer_tbl(l_rec - 1).person_last_name;
16815 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_PREFIX;
16816 l_customer_tbl(l_rec).department := l_customer_tbl(l_rec - 1).department;
16817 l_customer_tbl(l_rec).job_title := l_customer_tbl(l_rec - 1).job_title;
16818 l_customer_tbl(l_rec).decision_maker_flag := l_customer_tbl(l_rec - 1).decision_maker_flag;
16819
16820 l_customer_tbl(l_rec).PERSONAL_INCOME := l_customer_tbl(l_rec - 1).PERSONAL_INCOME;
16821 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := l_customer_tbl(l_rec - 1).PERSON_ACADEMIC_TITLE;
16822 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME_PHONETIC ;
16823 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME_PHONETIC;
16824 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := l_customer_tbl(l_rec - 1).MIDDLE_NAME_PHONETIC;
16825 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_NAME_PHONETIC;
16826 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := l_customer_tbl(l_rec - 1).PERSON_PREVIOUS_TITLE_NAME ;
16827 l_customer_tbl(l_rec).PLACE_OF_BIRTH := l_customer_tbl(l_rec - 1).PLACE_OF_BIRTH;
16828 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := l_customer_tbl(l_rec - 1).HEAD_OF_HOUSEHOLD_FLAG;
16829 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := l_customer_tbl(l_rec - 1).HOUSEHOLD_SIZE;
16830 l_customer_tbl(l_rec).TAX_ID := l_customer_tbl(l_rec - 1).TAX_ID;
16831 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE_CATEGORY;
16832 l_customer_tbl(l_rec).DATE_OF_BIRTH := l_customer_tbl(l_rec - 1).DATE_OF_BIRTH;
16833 l_customer_tbl(l_rec).DATE_OF_DEATH := l_customer_tbl(l_rec - 1).DATE_OF_DEATH;
16834 l_customer_tbl(l_rec).DECLARED_ETHNICITY := l_customer_tbl(l_rec - 1).DECLARED_ETHNICITY;
16835 l_customer_tbl(l_rec).MARITAL_STATUS := l_customer_tbl(l_rec - 1).MARITAL_STATUS;
16836 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).MARITAL_STATUS_EFFECTIVE_DATE;
16837 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE1;
16838 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE2;
16839 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE3;
16840 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE4;
16841 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE5;
16842 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE6;
16843 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE7;
16844 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE8;
16845 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE9;
16846 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE10;
16847 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE11;
16848 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE12;
16849 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE13;
16850 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE14;
16851 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE15;
16852
16853 end if;
16854 -- l_customer_tbl(l_rec).cp_imp_xml_element_id := l_phiid_record_in_tbl(i).imp_xml_element_id;
16855 l_customer_tbl(l_rec).cp_imp_xml_element_id := l_phoid_record_in_tbl(k).imp_xml_element_id;
16856 l_customer_tbl(l_rec).phone_number := Get_Element_VALUE('PHONE_NUMBER',l_phiid_record_in_tbl);
16857 l_customer_tbl(l_rec).phone_country_code := Get_Element_VALUE('PHONE_COUNTRY_CODE',l_phiid_record_in_tbl);
16858 l_customer_tbl(l_rec).phone_area_code := Get_Element_VALUE('PHONE_AREA_CODE',l_phiid_record_in_tbl);
16859 l_customer_tbl(l_rec).phone_extension := Get_Element_VALUE('PHONE_EXTENTION',l_phiid_record_in_tbl);
16860 l_rec := 0;
16861 END LOOP; -- Phone
16862
16863
16864 -- Process of Email data.
16865 l_ema_element_id := Get_Element_ID('EMAIL',l_conid_record_in_tbl);
16866 -- dbms_output.put_line( ' l_ema_element_id = '||to_char(l_ema_element_id));
16867
16868 /********* Get all the elements for email *****************************/
16869 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16870 p_imp_xml_element_id => l_ema_element_id,
16871 x_child_set => l_emaid_record_in_tbl,
16872 x_return_status => x_return_status,
16873 x_msg_data => x_msg_data);
16874 -- dbms_output.put_line( ' attributl email count '||l_emaid_record_in_tbl.COUNT);
16875 FOR l IN 1..l_emaid_record_in_tbl.COUNT LOOP
16876 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
16877 p_imp_xml_element_id => l_emaid_record_in_tbl(l).imp_xml_element_id,
16878 x_child_set => l_emlid_record_in_tbl,
16879 x_return_status => x_return_status,
16880 x_msg_data => x_msg_data);
16881 -- dbms_output.put_line( ' in l_emlid_record_in_tbl count '||l_emlid_record_in_tbl.COUNT);
16882
16883 l_rec := l_customer_tbl.count;
16884 if l > 1 then
16885 l_rec := l_customer_tbl.count+1;
16886 l_customer_tbl(l_rec).cust_data_id := l_rec;
16887 l_customer_tbl(l_rec).org_imp_xml_element_id := l_customer_tbl(l_rec - 1).org_imp_xml_element_id;
16888 l_customer_tbl(l_rec).party_name := l_customer_tbl(l_rec - 1).party_name;
16889 l_customer_tbl(l_rec).FISCAL_YEAREND_MONTH := l_customer_tbl(l_rec - 1).FISCAL_YEAREND_MONTH;
16890 l_customer_tbl(l_rec).DUNS_NUMBER := l_customer_tbl(l_rec - 1).DUNS_NUMBER;
16891 l_customer_tbl(l_rec).EMPLOYEES_TOTAL := l_customer_tbl(l_rec - 1).EMPLOYEES_TOTAL;
16892 l_customer_tbl(l_rec).LINE_OF_BUSINESS := l_customer_tbl(l_rec - 1).LINE_OF_BUSINESS;
16893 l_customer_tbl(l_rec).YEAR_ESTABLISHED := l_customer_tbl(l_rec - 1).YEAR_ESTABLISHED;
16894 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
16895 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
16896 l_customer_tbl(l_rec).CEO_NAME := l_customer_tbl(l_rec - 1).CEO_NAME;
16897 l_customer_tbl(l_rec).SIC_CODE := l_customer_tbl(l_rec - 1).SIC_CODE;
16898 l_customer_tbl(l_rec).SIC_CODE_TYPE := l_customer_tbl(l_rec - 1).SIC_CODE_TYPE;
16899 l_customer_tbl(l_rec).ANALYSIS_FY := l_customer_tbl(l_rec - 1).ANALYSIS_FY;
16900 l_customer_tbl(l_rec).CURR_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).CURR_FY_POTENTIAL_REVENUE;
16901 l_customer_tbl(l_rec).NEXT_FY_POTENTIAL_REVENUE := l_customer_tbl(l_rec - 1).NEXT_FY_POTENTIAL_REVENUE;
16902 l_customer_tbl(l_rec).GSA_INDICATOR_FLAG := l_customer_tbl(l_rec - 1).GSA_INDICATOR_FLAG;
16903 l_customer_tbl(l_rec).MISSION_STATEMENT := l_customer_tbl(l_rec - 1).MISSION_STATEMENT;
16904 l_customer_tbl(l_rec).ORGANIZATION_NAME_PHONETIC := l_customer_tbl(l_rec - 1).ORGANIZATION_NAME_PHONETIC;
16905 l_customer_tbl(l_rec).CATEGORY_CODE := l_customer_tbl(l_rec - 1).CATEGORY_CODE;
16906 l_customer_tbl(l_rec).JGZZ_FISCAL_CODE := l_customer_tbl(l_rec - 1).JGZZ_FISCAL_CODE;
16907 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
16908 l_customer_tbl(l_rec).BRANCH_FLAG := l_customer_tbl(l_rec - 1).BRANCH_FLAG;
16909 l_customer_tbl(l_rec).BUSINESS_LINE := l_customer_tbl(l_rec - 1).BUSINESS_LINE;
16910 l_customer_tbl(l_rec).BUSINESS_SCOPE := l_customer_tbl(l_rec - 1).BUSINESS_SCOPE;
16911 l_customer_tbl(l_rec).CHIEF_EXECUTIVE_TITLE := l_customer_tbl(l_rec - 1).CHIEF_EXECUTIVE_TITLE;
16912 l_customer_tbl(l_rec).CONGRESSIONAL_DISTRICT_CODE := l_customer_tbl(l_rec - 1).CONGRESSIONAL_DISTRICT_CODE;
16913 l_customer_tbl(l_rec).CONTROL_YEAR := l_customer_tbl(l_rec - 1).CONTROL_YEAR;
16914 l_customer_tbl(l_rec).CORPORATION_CLASS := l_customer_tbl(l_rec - 1).CORPORATION_CLASS;
16915 l_customer_tbl(l_rec).CREDIT_SCORE := l_customer_tbl(l_rec - 1).CREDIT_SCORE;
16916 l_customer_tbl(l_rec).CREDIT_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).CREDIT_SCORE_COMMENTARY;
16917 l_customer_tbl(l_rec).CUSTOMER_CATEGORY := l_customer_tbl(l_rec - 1).CUSTOMER_CATEGORY;
16918 l_customer_tbl(l_rec).DB_RATING := l_customer_tbl(l_rec - 1).DB_RATING;
16919 l_customer_tbl(l_rec).DEBARMENTS_COUNT := l_customer_tbl(l_rec - 1).DEBARMENTS_COUNT;
16920 l_customer_tbl(l_rec).DEBARTMENTS_DATE := l_customer_tbl(l_rec - 1).DEBARTMENTS_DATE;
16921 l_customer_tbl(l_rec).DEPARTMENT_INDICATOR := l_customer_tbl(l_rec - 1).DEPARTMENT_INDICATOR;
16922 l_customer_tbl(l_rec).DISADVANTAGED_INDICATOR := l_customer_tbl(l_rec - 1).DISADVANTAGED_INDICATOR;
16923 l_customer_tbl(l_rec).ENQUIRY_DUNS := l_customer_tbl(l_rec - 1).ENQUIRY_DUNS;
16924 l_customer_tbl(l_rec).EXPORT_INDICATOR := l_customer_tbl(l_rec - 1).EXPORT_INDICATOR;
16925 l_customer_tbl(l_rec).FAILURE_SCORE := l_customer_tbl(l_rec - 1).FAILURE_SCORE;
16926 l_customer_tbl(l_rec).FAILURE_SCORE_COMMENTARY := l_customer_tbl(l_rec - 1).FAILURE_SCORE_COMMENTARY;
16927 l_customer_tbl(l_rec).FAILURE_SCORE_NATL_PERCENTILE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_NATL_PERCENTILE;
16928 l_customer_tbl(l_rec).FAILURE_SCORE_OVERRIDE_CODE := l_customer_tbl(l_rec - 1).FAILURE_SCORE_OVERRIDE_CODE;
16929 l_customer_tbl(l_rec).GLOBAL_FAILURE_SCORE := l_customer_tbl(l_rec - 1).GLOBAL_FAILURE_SCORE;
16930 l_customer_tbl(l_rec).HEADQUARTER_BRANCH_INDICATOR := l_customer_tbl(l_rec - 1).HEADQUARTER_BRANCH_INDICATOR;
16931 l_customer_tbl(l_rec).IMPORT_INDICATOR := l_customer_tbl(l_rec - 1).IMPORT_INDICATOR;
16932 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS;
16933 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS2 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS2;
16934 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS3 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS3;
16935 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS4 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS4;
16936 l_customer_tbl(l_rec).ORGANIZATION_KNOWN_AS5 := l_customer_tbl(l_rec - 1).ORGANIZATION_KNOWN_AS5;
16937 l_customer_tbl(l_rec).LABOR_SURPLUS_INDICATOR := l_customer_tbl(l_rec - 1).LABOR_SURPLUS_INDICATOR;
16938 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE;
16939 l_customer_tbl(l_rec).LOCAL_ACTIVITY_CODE_TYPE := l_customer_tbl(l_rec - 1).LOCAL_ACTIVITY_CODE_TYPE;
16940 l_customer_tbl(l_rec).MINORITY_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).MINORITY_OWNED_INDICATOR;
16941 l_customer_tbl(l_rec).MINORITY_OWNED_TYPE := l_customer_tbl(l_rec - 1).MINORITY_OWNED_TYPE;
16942 l_customer_tbl(l_rec).ORGANIZATION_TYPE := l_customer_tbl(l_rec - 1).ORGANIZATION_TYPE;
16943 l_customer_tbl(l_rec).ORGANIZATION_URL := l_customer_tbl(l_rec - 1).ORGANIZATION_URL;
16944 l_customer_tbl(l_rec).OUT_OF_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).OUT_OF_BUSINESS_INDICATOR;
16945 l_customer_tbl(l_rec).PRINCIPAL_NAME := l_customer_tbl(l_rec - 1).PRINCIPAL_NAME;
16946 l_customer_tbl(l_rec).PRINCIPAL_TITLE := l_customer_tbl(l_rec - 1).PRINCIPAL_TITLE;
16947 l_customer_tbl(l_rec).PUBLIC_PRIVATE_OWNERSHIP_FLAG := l_customer_tbl(l_rec - 1).PUBLIC_PRIVATE_OWNERSHIP_FLAG;
16948 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
16949 l_customer_tbl(l_rec).RENT_OWNER_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNER_INDICATOR;
16950 l_customer_tbl(l_rec).SMALL_BUSINESS_INDICATOR := l_customer_tbl(l_rec - 1).SMALL_BUSINESS_INDICATOR;
16951 l_customer_tbl(l_rec).WOMAN_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).WOMAN_OWNED_INDICATOR;
16952 l_customer_tbl(l_rec).ORG_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ORG_ATTRIBUTE_CATEGORY;
16953 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE1;
16954 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE2;
16955 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE3;
16956 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE4;
16957 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE5;
16958 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE6;
16959 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE7;
16960 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE8;
16961 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE9;
16962 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE10;
16963 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE11;
16964 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE12;
16965 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE13;
16966 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE14;
16967 l_customer_tbl(l_rec).ORGANIZATION_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ORGANIZATION_ATTRIBUTE15;
16968 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
16969 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
16970 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
16971
16972
16973 l_customer_tbl(l_rec).add_imp_xml_element_id := l_customer_tbl(l_rec - 1).add_imp_xml_element_id;
16974 l_customer_tbl(l_rec).address1 := l_customer_tbl(l_rec - 1).address1;
16975 l_customer_tbl(l_rec).address2 := l_customer_tbl(l_rec - 1).address2;
16976 l_customer_tbl(l_rec).address3 := l_customer_tbl(l_rec - 1).address3;
16977 l_customer_tbl(l_rec).address4 := l_customer_tbl(l_rec - 1).address4;
16978 l_customer_tbl(l_rec).city := l_customer_tbl(l_rec - 1).city;
16979 l_customer_tbl(l_rec).county := l_customer_tbl(l_rec - 1).county;
16980 l_customer_tbl(l_rec).province := l_customer_tbl(l_rec - 1).province;
16981 l_customer_tbl(l_rec).state := l_customer_tbl(l_rec - 1).state;
16982 l_customer_tbl(l_rec).postal_code := l_customer_tbl(l_rec - 1).postal_code;
16983 l_customer_tbl(l_rec).country := l_customer_tbl(l_rec - 1).country;
16984 l_customer_tbl(l_rec).address_lines_phonetic := l_customer_tbl(l_rec - 1).address_lines_phonetic;
16985 -- bug 4641591: columns obsolete
16986 -- l_customer_tbl(l_rec).po_box_number := l_customer_tbl(l_rec - 1).po_box_number;
16987 -- l_customer_tbl(l_rec).house_number := l_customer_tbl(l_rec - 1).house_number;
16988 -- l_customer_tbl(l_rec).street_suffix := l_customer_tbl(l_rec - 1).street_suffix;
16989 -- l_customer_tbl(l_rec).street := l_customer_tbl(l_rec - 1).street;
16990 -- l_customer_tbl(l_rec).street_number := l_customer_tbl(l_rec - 1).street_number;
16991 -- l_customer_tbl(l_rec).floor := l_customer_tbl(l_rec - 1).floor;
16992 -- l_customer_tbl(l_rec).suite := l_customer_tbl(l_rec - 1).suite;
16993 l_customer_tbl(l_rec).postal_plus4_code := l_customer_tbl(l_rec - 1).postal_plus4_code;
16994 l_customer_tbl(l_rec).identifying_address_flag := l_customer_tbl(l_rec - 1).identifying_address_flag;
16995 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE1;
16996 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE2;
16997 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE3;
16998 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE4;
16999 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE5;
17000 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE6;
17001 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE7;
17002 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE8;
17003 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE9;
17004 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE10;
17005 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE11;
17006 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE12;
17007 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE13;
17008 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE14;
17009 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE15;
17010 l_customer_tbl(l_rec).DESCRIPTION := l_customer_tbl(l_rec - 1).DESCRIPTION;
17011 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE_CATEGORY;
17012 l_customer_tbl(l_rec).PARTY_SITE_USE := l_customer_tbl(l_rec - 1).PARTY_SITE_USE;
17013 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := l_customer_tbl(l_rec - 1).LOCATION_DIRECTIONS;
17014 l_customer_tbl(l_rec).SHORT_DESCRIPTION := l_customer_tbl(l_rec - 1).SHORT_DESCRIPTION;
17015 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EFFECTIVE_DATE;
17016 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EXPIRATION_DATE;
17017
17018
17019 l_customer_tbl(l_rec).ocont_imp_xml_element_id := l_customer_tbl(l_rec - 1).ocont_imp_xml_element_id;
17020 l_customer_tbl(l_rec).person_first_name := l_customer_tbl(l_rec - 1).person_first_name;
17021 l_customer_tbl(l_rec).person_middle_name := l_customer_tbl(l_rec - 1).person_middle_name;
17022 l_customer_tbl(l_rec).person_name_suffix := l_customer_tbl(l_rec - 1).person_name_suffix;
17023 l_customer_tbl(l_rec).person_last_name := l_customer_tbl(l_rec - 1).person_last_name;
17024 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_PREFIX;
17025 l_customer_tbl(l_rec).department := l_customer_tbl(l_rec - 1).department;
17026 l_customer_tbl(l_rec).job_title := l_customer_tbl(l_rec - 1).job_title;
17027 l_customer_tbl(l_rec).decision_maker_flag := l_customer_tbl(l_rec - 1).decision_maker_flag;
17028 l_customer_tbl(l_rec).PERSONAL_INCOME := l_customer_tbl(l_rec - 1).PERSONAL_INCOME;
17029 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := l_customer_tbl(l_rec - 1).PERSON_ACADEMIC_TITLE;
17030 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME_PHONETIC ;
17031 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME_PHONETIC;
17032 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := l_customer_tbl(l_rec - 1).MIDDLE_NAME_PHONETIC;
17033 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_NAME_PHONETIC;
17034 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := l_customer_tbl(l_rec - 1).PERSON_PREVIOUS_TITLE_NAME ;
17035 l_customer_tbl(l_rec).PLACE_OF_BIRTH := l_customer_tbl(l_rec - 1).PLACE_OF_BIRTH;
17036 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := l_customer_tbl(l_rec - 1).HEAD_OF_HOUSEHOLD_FLAG;
17037 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := l_customer_tbl(l_rec - 1).HOUSEHOLD_SIZE;
17038 l_customer_tbl(l_rec).TAX_ID := l_customer_tbl(l_rec - 1).TAX_ID;
17039 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE_CATEGORY;
17040 l_customer_tbl(l_rec).DATE_OF_BIRTH := l_customer_tbl(l_rec - 1).DATE_OF_BIRTH;
17041 l_customer_tbl(l_rec).DATE_OF_DEATH := l_customer_tbl(l_rec - 1).DATE_OF_DEATH;
17042 l_customer_tbl(l_rec).DECLARED_ETHNICITY := l_customer_tbl(l_rec - 1).DECLARED_ETHNICITY;
17043 l_customer_tbl(l_rec).MARITAL_STATUS := l_customer_tbl(l_rec - 1).MARITAL_STATUS;
17044 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).MARITAL_STATUS_EFFECTIVE_DATE;
17045 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE1;
17046 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE2;
17047 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE3;
17048 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE4;
17049 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE5;
17050 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE6;
17051 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE7;
17052 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE8;
17053 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE9;
17054 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE10;
17055 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE11;
17056 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE12;
17057 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE13;
17058 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE14;
17059 l_customer_tbl(l_rec).ORG_CONTACT_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ORG_CONTACT_ATTRIBUTE15;
17060
17061 end if;
17062 l_customer_tbl(l_rec).em_imp_xml_element_id := l_emaid_record_in_tbl(l).imp_xml_element_id;
17063 -- l_customer_tbl(l_rec).em_imp_xml_element_id := l_emlid_record_in_tbl(l).imp_xml_element_id;
17064 l_customer_tbl(l_rec).email_address := Get_Element_VALUE('EMAIL_ADDRESS',l_emlid_record_in_tbl);
17065 /*
17066 -- dbms_output.put_line( ' em_imp_xml_element_id '||l_customer_tbl(l_rec).em_imp_xml_element_id);
17067 -- dbms_output.put_line( ' EMAIL_ADDRESS '||l_customer_tbl(l_rec).EMAIL_ADDRESS);
17068 */
17069 l_rec := 0;
17070 END LOOP; -- Email
17071
17072 END LOOP; -- Org Contaaaaat process
17073 -- ******************************Location process
17074
17075 END LOOP; -- Locarion process
17076 p_cust_tbl := l_customer_tbl;
17077
17078 exception
17079 WHEN OTHERS THEN
17080 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
17081 FND_MESSAGE.Set_Token('ROW','Error in Process_b2b_xml_data :' || SQLERRM||' '||SQLCODE);
17082 AMS_Utility_PVT.Create_Log (
17083 x_return_status => x_return_status,
17084 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
17085 p_log_used_by_id => p_import_list_header_id,
17086 p_msg_data => FND_MESSAGE.get,
17087 p_msg_type => 'DEBUG'
17088 );
17089
17090
17091 end Process_b2b_xml_data;
17092 -- ********************************************************************
17093 --
17094 -- This program processes the xml data.
17095 --
17096 PROCEDURE Process_b2c_xml_data (
17097 p_import_list_header_id IN NUMBER,
17098 p_xml_element_id IN NUMBER,
17099 p_cust_tbl IN OUT NOCOPY cust_b2c_data_in_tbl,
17100 x_return_status OUT NOCOPY VARCHAR2,
17101 x_msg_data OUT NOCOPY VARCHAR2
17102 ) IS
17103 l_loc_element_id NUMBER;
17104 l_oct_element_id NUMBER;
17105 l_pho_element_id NUMBER;
17106 l_ema_element_id NUMBER;
17107 l_rec NUMBER := 1;
17108
17109 party_rec hz_party_v2pub.party_rec_type;
17110 org_rec hz_party_v2pub.organization_rec_type;
17111 person_rec hz_party_v2pub.person_rec_type;
17112 location_rec hz_location_v2pub.location_rec_type;
17113 psite_rec hz_party_site_v2pub.party_site_rec_type;
17114 cpoint_rec hz_contact_point_v2pub.contact_point_rec_type;
17115 email_rec hz_contact_point_v2pub.email_rec_type;
17116 phone_rec hz_contact_point_v2pub.phone_rec_type;
17117 ocon_rec hz_party_contact_v2pub.org_contact_rec_type;
17118 edi_rec hz_contact_point_v2pub.edi_rec_type;
17119 telex_rec hz_contact_point_v2pub.telex_rec_type;
17120 web_rec hz_contact_point_v2pub.web_rec_type;
17121
17122 l_perid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17123 l_locid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17124 l_addid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17125 l_octid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17126 l_conid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17127 l_phoid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17128 l_phiid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17129 l_emaid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17130 l_emlid_record_in_tbl AMS_IMPORT_XML_PVT.xml_element_set_type;
17131 l_customer_tbl cust_b2c_data_in_tbl;
17132
17133 begin
17134 /********* Get all the elements for the Person *****************************/
17135 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17136 p_imp_xml_element_id => p_xml_element_id,
17137 x_child_set => l_perid_record_in_tbl,
17138 x_return_status => x_return_status,
17139 x_msg_data => x_msg_data);
17140
17141 -- dbms_output.put_line( ' Person attribute count '||l_perid_record_in_tbl.COUNT);
17142 /*
17143 FOR i IN 1..l_perid_record_in_tbl.COUNT LOOP
17144 -- dbms_output.put_line('Per att '||l_perid_record_in_tbl(i).column_name||'>>>'||l_perid_record_in_tbl(i).data);
17145 END LOOP;
17146 */
17147 l_customer_tbl(l_rec).cust_data_id := l_rec;
17148 l_customer_tbl(l_rec).per_imp_xml_element_id := p_xml_element_id;
17149
17150 l_customer_tbl(l_rec).person_first_name := Get_Element_VALUE('PERSON_FIRST_NAME',l_perid_record_in_tbl);
17151 l_customer_tbl(l_rec).person_last_name := Get_Element_VALUE('PERSON_LAST_NAME',l_perid_record_in_tbl);
17152 l_customer_tbl(l_rec).person_middle_name := Get_Element_VALUE('PERSON_MIDDLE_NAME',l_perid_record_in_tbl);
17153 l_customer_tbl(l_rec).person_name_suffix := Get_Element_VALUE('PERSON_NAME_SUFFIX',l_perid_record_in_tbl);
17154 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := Get_Element_VALUE('PERSON_NAME_PREFIX',l_perid_record_in_tbl);
17155 l_customer_tbl(l_rec).SALUTATION := Get_Element_VALUE('SALUTATION',l_perid_record_in_tbl);
17156
17157 l_customer_tbl(l_rec).PARTY_ID := Get_Element_VALUE('PARTY_ID',l_perid_record_in_tbl);
17158 l_customer_tbl(l_rec).PERSONAL_INCOME := Get_Element_VALUE('PERSONAL_INCOME',l_perid_record_in_tbl);
17159 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := Get_Element_VALUE('PERSON_ACADEMIC_TITLE',l_perid_record_in_tbl);
17160 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := Get_Element_VALUE('PERSON_FIRST_NAME_PHONETIC',l_perid_record_in_tbl);
17161 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := Get_Element_VALUE('PERSON_LAST_NAME_PHONETIC',l_perid_record_in_tbl);
17162 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := Get_Element_VALUE('MIDDLE_NAME_PHONETIC',l_perid_record_in_tbl);
17163 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := Get_Element_VALUE('PERSON_NAME_PHONETIC',l_perid_record_in_tbl);
17164 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := Get_Element_VALUE('PERSON_PREVIOUS_TITLE_NAME',l_perid_record_in_tbl);
17165 l_customer_tbl(l_rec).PLACE_OF_BIRTH := Get_Element_VALUE('PLACE_OF_BIRTH',l_perid_record_in_tbl);
17166 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := Get_Element_VALUE('HEAD_OF_HOUSEHOLD_FLAG',l_perid_record_in_tbl);
17167 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := Get_Element_VALUE('HOUSEHOLD_SIZE',l_perid_record_in_tbl);
17168 l_customer_tbl(l_rec).TAX_REFERENCE := Get_Element_VALUE('TAX_REFERENCE',l_perid_record_in_tbl);
17169 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := Get_Element_VALUE('ORIG_SYSTEM_REFERENCE',l_perid_record_in_tbl);
17170 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := Get_Element_VALUE('RENT_OWNED_INDICATOR',l_perid_record_in_tbl);
17171 l_customer_tbl(l_rec).PERSON_ATTRIBUTE_CATEGORY := Get_Element_VALUE('PERSON_ATTRIBUTE_CATEGORY',l_perid_record_in_tbl);
17172 l_customer_tbl(l_rec).DATE_OF_BIRTH := Get_Element_VALUE('DATE_OF_BIRTH',l_perid_record_in_tbl);
17173 l_customer_tbl(l_rec).DATE_OF_DEATH := Get_Element_VALUE('DATE_OF_DEATH',l_perid_record_in_tbl);
17174 l_customer_tbl(l_rec).DECLARED_ETHNICITY := Get_Element_VALUE('DECLARED_ETHNICITY',l_perid_record_in_tbl);
17175 l_customer_tbl(l_rec).MARITAL_STATUS := Get_Element_VALUE('MARITAL_STATUS',l_perid_record_in_tbl);
17176 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := Get_Element_VALUE('MARITAL_STATUS_EFFECTIVE_DATE',l_perid_record_in_tbl);
17177 l_customer_tbl(l_rec).PERSON_ATTRIBUTE1 := Get_Element_VALUE('PERSON_ATTRIBUTE1',l_perid_record_in_tbl);
17178 l_customer_tbl(l_rec).PERSON_ATTRIBUTE2 := Get_Element_VALUE('PERSON_ATTRIBUTE2',l_perid_record_in_tbl);
17179 l_customer_tbl(l_rec).PERSON_ATTRIBUTE3 := Get_Element_VALUE('PERSON_ATTRIBUTE3',l_perid_record_in_tbl);
17180 l_customer_tbl(l_rec).PERSON_ATTRIBUTE4 := Get_Element_VALUE('PERSON_ATTRIBUTE4',l_perid_record_in_tbl);
17181 l_customer_tbl(l_rec).PERSON_ATTRIBUTE5 := Get_Element_VALUE('PERSON_ATTRIBUTE5',l_perid_record_in_tbl);
17182 l_customer_tbl(l_rec).PERSON_ATTRIBUTE6 := Get_Element_VALUE('PERSON_ATTRIBUTE6',l_perid_record_in_tbl);
17183 l_customer_tbl(l_rec).PERSON_ATTRIBUTE7 := Get_Element_VALUE('PERSON_ATTRIBUTE7',l_perid_record_in_tbl);
17184 l_customer_tbl(l_rec).PERSON_ATTRIBUTE8 := Get_Element_VALUE('PERSON_ATTRIBUTE8',l_perid_record_in_tbl);
17185 l_customer_tbl(l_rec).PERSON_ATTRIBUTE9 := Get_Element_VALUE('PERSON_ATTRIBUTE9',l_perid_record_in_tbl);
17186 l_customer_tbl(l_rec).PERSON_ATTRIBUTE10 := Get_Element_VALUE('PERSON_ATTRIBUTE10',l_perid_record_in_tbl) ;
17187 l_customer_tbl(l_rec).PERSON_ATTRIBUTE11 := Get_Element_VALUE('PERSON_ATTRIBUTE11',l_perid_record_in_tbl) ;
17188 l_customer_tbl(l_rec).PERSON_ATTRIBUTE12 := Get_Element_VALUE('PERSON_ATTRIBUTE12',l_perid_record_in_tbl) ;
17189 l_customer_tbl(l_rec).PERSON_ATTRIBUTE13 := Get_Element_VALUE('PERSON_ATTRIBUTE13',l_perid_record_in_tbl) ;
17190 l_customer_tbl(l_rec).PERSON_ATTRIBUTE14 := Get_Element_VALUE('PERSON_ATTRIBUTE14',l_perid_record_in_tbl) ;
17191 l_customer_tbl(l_rec).PERSON_ATTRIBUTE15 := Get_Element_VALUE('PERSON_ATTRIBUTE15',l_perid_record_in_tbl) ;
17192
17193 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := Get_Element_VALUE('VEHICLE_RESPONSE_CODE',l_perid_record_in_tbl) ;
17194 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := Get_Element_VALUE('SALES_AGENT_EMAIL_ID',l_perid_record_in_tbl) ;
17195 l_customer_tbl(l_rec).NOTES := Get_Element_VALUE('NOTES',l_perid_record_in_tbl) ;
17196
17197 /*
17198 -- dbms_output.put_line( ' cust_data_id '||l_customer_tbl(l_rec).cust_data_id);
17199 -- dbms_output.put_line( ' per_imp_xml_element_id '||l_customer_tbl(l_rec).per_imp_xml_element_id);
17200 -- dbms_output.put_line( ' Pat-name '||l_customer_tbl(l_rec).PERSON_FIRST_NAME);
17201 */
17202 -- Process for location data.
17203 l_loc_element_id := Get_Element_ID('LOCATION',l_perid_record_in_tbl);
17204 -- dbms_output.put_line( ' l_loc_element_id = '||to_char(l_loc_element_id));
17205
17206 /********* Get all the elements for the location *****************************/
17207 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17208 p_imp_xml_element_id => l_loc_element_id,
17209 x_child_set => l_locid_record_in_tbl,
17210 x_return_status => x_return_status,
17211 x_msg_data => x_msg_data);
17212 -- dbms_output.put_line( ' Location attribute count '||l_locid_record_in_tbl.COUNT);
17213 FOR i IN 1..l_locid_record_in_tbl.COUNT LOOP
17214 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17215 p_imp_xml_element_id => l_locid_record_in_tbl(i).imp_xml_element_id,
17216 x_child_set => l_addid_record_in_tbl,
17217 x_return_status => x_return_status,
17218 x_msg_data => x_msg_data);
17219
17220 l_rec := l_customer_tbl.count;
17221 if i > 1 then
17222 l_rec := l_customer_tbl.count+1;
17223 l_customer_tbl(l_rec).cust_data_id := l_rec;
17224 l_customer_tbl(l_rec).per_imp_xml_element_id := l_customer_tbl(l_rec - 1).per_imp_xml_element_id;
17225 l_customer_tbl(l_rec).PERSON_FIRST_NAME := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME;
17226 l_customer_tbl(l_rec).PERSON_LAST_NAME := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME;
17227 l_customer_tbl(l_rec).PERSON_MIDDLE_NAME := l_customer_tbl(l_rec - 1).PERSON_MIDDLE_NAME;
17228 l_customer_tbl(l_rec).PERSON_NAME_SUFFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_SUFFIX;
17229 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_PREFIX;
17230 l_customer_tbl(l_rec).SALUTATION := l_customer_tbl(l_rec - 1).SALUTATION;
17231 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
17232
17233 l_customer_tbl(l_rec).PERSONAL_INCOME := l_customer_tbl(l_rec - 1).PERSONAL_INCOME;
17234 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := l_customer_tbl(l_rec - 1).PERSON_ACADEMIC_TITLE;
17235 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME_PHONETIC ;
17236 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME_PHONETIC;
17237 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := l_customer_tbl(l_rec - 1).MIDDLE_NAME_PHONETIC;
17238 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_NAME_PHONETIC;
17239 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := l_customer_tbl(l_rec - 1).PERSON_PREVIOUS_TITLE_NAME ;
17240 l_customer_tbl(l_rec).PLACE_OF_BIRTH := l_customer_tbl(l_rec - 1).PLACE_OF_BIRTH;
17241 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := l_customer_tbl(l_rec - 1).HEAD_OF_HOUSEHOLD_FLAG;
17242 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := l_customer_tbl(l_rec - 1).HOUSEHOLD_SIZE;
17243 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
17244 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
17245 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
17246 l_customer_tbl(l_rec).PERSON_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE_CATEGORY;
17247 l_customer_tbl(l_rec).DATE_OF_BIRTH := l_customer_tbl(l_rec - 1).DATE_OF_BIRTH;
17248 l_customer_tbl(l_rec).DATE_OF_DEATH := l_customer_tbl(l_rec - 1).DATE_OF_DEATH;
17249 l_customer_tbl(l_rec).DECLARED_ETHNICITY := l_customer_tbl(l_rec - 1).DECLARED_ETHNICITY;
17250 l_customer_tbl(l_rec).MARITAL_STATUS := l_customer_tbl(l_rec - 1).MARITAL_STATUS;
17251 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).MARITAL_STATUS_EFFECTIVE_DATE;
17252 l_customer_tbl(l_rec).PERSON_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE1;
17253 l_customer_tbl(l_rec).PERSON_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE2;
17254 l_customer_tbl(l_rec).PERSON_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE3;
17255 l_customer_tbl(l_rec).PERSON_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE4;
17256 l_customer_tbl(l_rec).PERSON_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE5;
17257 l_customer_tbl(l_rec).PERSON_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE6;
17258 l_customer_tbl(l_rec).PERSON_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE7;
17259 l_customer_tbl(l_rec).PERSON_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE8;
17260 l_customer_tbl(l_rec).PERSON_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE9;
17261 l_customer_tbl(l_rec).PERSON_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE10;
17262 l_customer_tbl(l_rec).PERSON_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE11;
17263 l_customer_tbl(l_rec).PERSON_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE12;
17264 l_customer_tbl(l_rec).PERSON_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE13;
17265 l_customer_tbl(l_rec).PERSON_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE14;
17266 l_customer_tbl(l_rec).PERSON_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE15;
17267
17268 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
17269 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
17270 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
17271 end if;
17272 -- l_customer_tbl(l_rec).add_imp_xml_element_id := l_addid_record_in_tbl(i).imp_xml_element_id;
17273 l_customer_tbl(l_rec).add_imp_xml_element_id := l_locid_record_in_tbl(i).imp_xml_element_id;
17274 l_customer_tbl(l_rec).address1 := Get_Element_VALUE('ADDRESS1',l_addid_record_in_tbl);
17275 l_customer_tbl(l_rec).address2 := Get_Element_VALUE('ADDRESS2',l_addid_record_in_tbl);
17276 l_customer_tbl(l_rec).address3 := Get_Element_VALUE('ADDRESS3',l_addid_record_in_tbl);
17277 l_customer_tbl(l_rec).address4 := Get_Element_VALUE('ADDRESS4',l_addid_record_in_tbl);
17278 l_customer_tbl(l_rec).CITY := Get_Element_VALUE('CITY',l_addid_record_in_tbl);
17279 l_customer_tbl(l_rec).COUNTY := Get_Element_VALUE('COUNTY',l_addid_record_in_tbl);
17280 l_customer_tbl(l_rec).PROVINCE := Get_Element_VALUE('PROVINCE',l_addid_record_in_tbl);
17281 l_customer_tbl(l_rec).STATE := Get_Element_VALUE('STATE',l_addid_record_in_tbl);
17282 l_customer_tbl(l_rec).POSTAL_CODE := Get_Element_VALUE('POSTAL_CODE',l_addid_record_in_tbl);
17283 l_customer_tbl(l_rec).COUNTRY := Get_Element_VALUE('COUNTRY',l_addid_record_in_tbl);
17284 l_customer_tbl(l_rec).ADDRESS_LINES_PHONETIC := Get_Element_VALUE('ADDRESS_LINES_PHONETIC',l_addid_record_in_tbl);
17285 -- bug 4641591: columns obsolete
17286 -- l_customer_tbl(l_rec).PO_BOX_NUMBER := Get_Element_VALUE('PO_BOX_NUMBER',l_addid_record_in_tbl);
17287 -- l_customer_tbl(l_rec).HOUSE_NUMBER := Get_Element_VALUE('HOUSE_NUMBER',l_addid_record_in_tbl);
17288 -- l_customer_tbl(l_rec).STREET_SUFFIX := Get_Element_VALUE('STREET_SUFFIX',l_addid_record_in_tbl);
17289 -- l_customer_tbl(l_rec).STREET := Get_Element_VALUE('STREET',l_addid_record_in_tbl);
17290 -- l_customer_tbl(l_rec).STREET_NUMBER := Get_Element_VALUE('STREET_NUMBER',l_addid_record_in_tbl);
17291 -- l_customer_tbl(l_rec).FLOOR := Get_Element_VALUE('FLOOR',l_addid_record_in_tbl);
17292 -- l_customer_tbl(l_rec).SUITE := Get_Element_VALUE('SUITE',l_addid_record_in_tbl);
17293 l_customer_tbl(l_rec).POSTAL_PLUS4_CODE := Get_Element_VALUE('POSTAL_PLUS4_CODE',l_addid_record_in_tbl);
17294 l_customer_tbl(l_rec).IDENTIFYING_ADDRESS_FLAG := Get_Element_VALUE('IDENTIFYING_ADDRESS_FLAG',l_addid_record_in_tbl);
17295
17296 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := Get_Element_VALUE('ADDRESS_ATTRIBUTE1',l_addid_record_in_tbl);
17297 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := Get_Element_VALUE('ADDRESS_ATTRIBUTE2',l_addid_record_in_tbl);
17298 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := Get_Element_VALUE('ADDRESS_ATTRIBUTE3',l_addid_record_in_tbl);
17299 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := Get_Element_VALUE('ADDRESS_ATTRIBUTE4',l_addid_record_in_tbl);
17300 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := Get_Element_VALUE('ADDRESS_ATTRIBUTE5',l_addid_record_in_tbl);
17301 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := Get_Element_VALUE('ADDRESS_ATTRIBUTE6',l_addid_record_in_tbl);
17302 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := Get_Element_VALUE('ADDRESS_ATTRIBUTE7',l_addid_record_in_tbl);
17303 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := Get_Element_VALUE('ADDRESS_ATTRIBUTE8',l_addid_record_in_tbl);
17304 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := Get_Element_VALUE('ADDRESS_ATTRIBUTE9',l_addid_record_in_tbl);
17305 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := Get_Element_VALUE('ADDRESS_ATTRIBUTE10',l_addid_record_in_tbl);
17306 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := Get_Element_VALUE('ADDRESS_ATTRIBUTE11',l_addid_record_in_tbl);
17307 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := Get_Element_VALUE('ADDRESS_ATTRIBUTE12',l_addid_record_in_tbl);
17308 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := Get_Element_VALUE('ADDRESS_ATTRIBUTE13',l_addid_record_in_tbl);
17309 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := Get_Element_VALUE('ADDRESS_ATTRIBUTE14',l_addid_record_in_tbl);
17310 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := Get_Element_VALUE('ADDRESS_ATTRIBUTE15',l_addid_record_in_tbl);
17311 l_customer_tbl(l_rec).DESCRIPTION := Get_Element_VALUE('DESCRIPTION',l_addid_record_in_tbl);
17312 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := Get_Element_VALUE('ADDRESS_ATTRIBUTE_CATEGORY',l_addid_record_in_tbl);
17313 l_customer_tbl(l_rec).PARTY_SITE_USE := Get_Element_VALUE('PARTY_SITE_USE',l_addid_record_in_tbl);
17314 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := Get_Element_VALUE('LOCATION_DIRECTIONS',l_addid_record_in_tbl);
17315 l_customer_tbl(l_rec).SHORT_DESCRIPTION := Get_Element_VALUE('SHORT_DESCRIPTION',l_addid_record_in_tbl);
17316 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := Get_Element_VALUE('ADDRESS_EFFECTIVE_DATE',l_addid_record_in_tbl);
17317 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := Get_Element_VALUE('ADDRESS_EXPIRATION_DATE',l_addid_record_in_tbl) ;
17318
17319
17320 -- dbms_output.put_line( ' cust_data_id '||l_customer_tbl(l_rec).cust_data_id);
17321 -- dbms_output.put_line( ' add_imp_xml_element_id'||l_customer_tbl(l_rec).add_imp_xml_element_id);
17322 -- dbms_output.put_line( ' address1 '||l_customer_tbl(l_rec).address1);
17323
17324 l_rec := 0;
17325 -- ****************************** End Location process
17326
17327 -- Process of Phone data.
17328 l_pho_element_id := Get_Element_ID('PHONE',l_addid_record_in_tbl);
17329 -- dbms_output.put_line( ' l_pho_element_id = '||to_char(l_pho_element_id));
17330
17331 /********* Get all the elements for phone *****************************/
17332 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17333 p_imp_xml_element_id => l_pho_element_id,
17334 x_child_set => l_phoid_record_in_tbl,
17335 x_return_status => x_return_status,
17336 x_msg_data => x_msg_data);
17337 -- dbms_output.put_line( ' Phone attribute count '||l_phoid_record_in_tbl.COUNT);
17338 FOR k IN 1..l_phoid_record_in_tbl.COUNT LOOP
17339 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17340 p_imp_xml_element_id => l_phoid_record_in_tbl(k).imp_xml_element_id,
17341 x_child_set => l_phiid_record_in_tbl,
17342 x_return_status => x_return_status,
17343 x_msg_data => x_msg_data);
17344
17345 l_rec := l_customer_tbl.count;
17346 if k > 1 then
17347 l_rec := l_customer_tbl.count+1;
17348 l_customer_tbl(l_rec).cust_data_id := l_rec;
17349
17350 l_customer_tbl(l_rec).per_imp_xml_element_id := l_customer_tbl(l_rec - 1).per_imp_xml_element_id;
17351 l_customer_tbl(l_rec).PERSON_FIRST_NAME := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME;
17352 l_customer_tbl(l_rec).PERSON_LAST_NAME := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME;
17353 l_customer_tbl(l_rec).PERSON_MIDDLE_NAME := l_customer_tbl(l_rec - 1).PERSON_MIDDLE_NAME;
17354 l_customer_tbl(l_rec).PERSON_NAME_SUFFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_SUFFIX;
17355 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_PREFIX;
17356 l_customer_tbl(l_rec).SALUTATION := l_customer_tbl(l_rec - 1).SALUTATION;
17357 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
17358
17359 l_customer_tbl(l_rec).PERSONAL_INCOME := l_customer_tbl(l_rec - 1).PERSONAL_INCOME;
17360 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := l_customer_tbl(l_rec - 1).PERSON_ACADEMIC_TITLE;
17361 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME_PHONETIC ;
17362 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME_PHONETIC;
17363 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := l_customer_tbl(l_rec - 1).MIDDLE_NAME_PHONETIC;
17364 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_NAME_PHONETIC;
17365 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := l_customer_tbl(l_rec - 1).PERSON_PREVIOUS_TITLE_NAME ;
17366 l_customer_tbl(l_rec).PLACE_OF_BIRTH := l_customer_tbl(l_rec - 1).PLACE_OF_BIRTH;
17367 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := l_customer_tbl(l_rec - 1).HEAD_OF_HOUSEHOLD_FLAG;
17368 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := l_customer_tbl(l_rec - 1).HOUSEHOLD_SIZE;
17369 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
17370 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
17371 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
17372 l_customer_tbl(l_rec).PERSON_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE_CATEGORY;
17373 l_customer_tbl(l_rec).DATE_OF_BIRTH := l_customer_tbl(l_rec - 1).DATE_OF_BIRTH;
17374 l_customer_tbl(l_rec).DATE_OF_DEATH := l_customer_tbl(l_rec - 1).DATE_OF_DEATH;
17375 l_customer_tbl(l_rec).DECLARED_ETHNICITY := l_customer_tbl(l_rec - 1).DECLARED_ETHNICITY;
17376 l_customer_tbl(l_rec).MARITAL_STATUS := l_customer_tbl(l_rec - 1).MARITAL_STATUS;
17377 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).MARITAL_STATUS_EFFECTIVE_DATE;
17378 l_customer_tbl(l_rec).PERSON_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE1;
17379 l_customer_tbl(l_rec).PERSON_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE2;
17380 l_customer_tbl(l_rec).PERSON_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE3;
17381 l_customer_tbl(l_rec).PERSON_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE4;
17382 l_customer_tbl(l_rec).PERSON_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE5;
17383 l_customer_tbl(l_rec).PERSON_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE6;
17384 l_customer_tbl(l_rec).PERSON_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE7;
17385 l_customer_tbl(l_rec).PERSON_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE8;
17386 l_customer_tbl(l_rec).PERSON_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE9;
17387 l_customer_tbl(l_rec).PERSON_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE10;
17388 l_customer_tbl(l_rec).PERSON_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE11;
17389 l_customer_tbl(l_rec).PERSON_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE12;
17390 l_customer_tbl(l_rec).PERSON_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE13;
17391 l_customer_tbl(l_rec).PERSON_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE14;
17392 l_customer_tbl(l_rec).PERSON_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE15;
17393 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
17394 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
17395 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
17396
17397
17398 l_customer_tbl(l_rec).add_imp_xml_element_id := l_customer_tbl(l_rec - 1).add_imp_xml_element_id;
17399 l_customer_tbl(l_rec).address1 := l_customer_tbl(l_rec - 1).address1;
17400 l_customer_tbl(l_rec).address2 := l_customer_tbl(l_rec - 1).address2;
17401 l_customer_tbl(l_rec).address3 := l_customer_tbl(l_rec - 1).address3;
17402 l_customer_tbl(l_rec).address4 := l_customer_tbl(l_rec - 1).address4;
17403 l_customer_tbl(l_rec).city := l_customer_tbl(l_rec - 1).city;
17404 l_customer_tbl(l_rec).county := l_customer_tbl(l_rec - 1).county;
17405 l_customer_tbl(l_rec).province := l_customer_tbl(l_rec - 1).province;
17406 l_customer_tbl(l_rec).state := l_customer_tbl(l_rec - 1).state;
17407 l_customer_tbl(l_rec).postal_code := l_customer_tbl(l_rec - 1).postal_code;
17408 l_customer_tbl(l_rec).country := l_customer_tbl(l_rec - 1).country;
17409 l_customer_tbl(l_rec).address_lines_phonetic := l_customer_tbl(l_rec - 1).address_lines_phonetic;
17410 -- bug 4641591: columns obsolete
17411 -- l_customer_tbl(l_rec).po_box_number := l_customer_tbl(l_rec - 1).po_box_number;
17412 -- l_customer_tbl(l_rec).house_number := l_customer_tbl(l_rec - 1).house_number;
17413 -- l_customer_tbl(l_rec).street_suffix := l_customer_tbl(l_rec - 1).street_suffix;
17414 -- l_customer_tbl(l_rec).street := l_customer_tbl(l_rec - 1).street;
17415 -- l_customer_tbl(l_rec).street_number := l_customer_tbl(l_rec - 1).street_number;
17416 -- l_customer_tbl(l_rec).floor := l_customer_tbl(l_rec - 1).floor;
17417 -- l_customer_tbl(l_rec).suite := l_customer_tbl(l_rec - 1).suite;
17418 l_customer_tbl(l_rec).postal_plus4_code := l_customer_tbl(l_rec - 1).postal_plus4_code;
17419 l_customer_tbl(l_rec).identifying_address_flag := l_customer_tbl(l_rec - 1).identifying_address_flag;
17420
17421 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE1;
17422 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE2;
17423 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE3;
17424 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE4;
17425 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE5;
17426 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE6;
17427 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE7;
17428 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE8;
17429 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE9;
17430 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE10;
17431 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE11;
17432 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE12;
17433 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE13;
17434 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE14;
17435 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE15;
17436 l_customer_tbl(l_rec).DESCRIPTION := l_customer_tbl(l_rec - 1).DESCRIPTION;
17437 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE_CATEGORY;
17438 l_customer_tbl(l_rec).PARTY_SITE_USE := l_customer_tbl(l_rec - 1).PARTY_SITE_USE;
17439 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := l_customer_tbl(l_rec - 1).LOCATION_DIRECTIONS;
17440 l_customer_tbl(l_rec).SHORT_DESCRIPTION := l_customer_tbl(l_rec - 1).SHORT_DESCRIPTION;
17441 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EFFECTIVE_DATE;
17442 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EXPIRATION_DATE;
17443
17444 end if;
17445
17446 -- l_customer_tbl(l_rec).cp_imp_xml_element_id := l_phiid_record_in_tbl(i).imp_xml_element_id;
17447 l_customer_tbl(l_rec).cp_imp_xml_element_id := l_phoid_record_in_tbl(k).imp_xml_element_id;
17448 l_customer_tbl(l_rec).phone_number := Get_Element_VALUE('PHONE_NUMBER',l_phiid_record_in_tbl);
17449 l_customer_tbl(l_rec).phone_country_code := Get_Element_VALUE('PHONE_COUNTRY_CODE',l_phiid_record_in_tbl);
17450 l_customer_tbl(l_rec).phone_area_code := Get_Element_VALUE('PHONE_AREA_CODE',l_phiid_record_in_tbl);
17451 l_customer_tbl(l_rec).phone_extension := Get_Element_VALUE('PHONE_EXTENTION',l_phiid_record_in_tbl);
17452 l_rec := 0;
17453 END LOOP; -- Phone
17454
17455
17456 -- Process of Email data.
17457 l_ema_element_id := Get_Element_ID('EMAIL',l_addid_record_in_tbl);
17458 -- dbms_output.put_line( ' l_ema_element_id = '||to_char(l_ema_element_id));
17459
17460 /********* Get all the elements for email *****************************/
17461 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17462 p_imp_xml_element_id => l_ema_element_id,
17463 x_child_set => l_emaid_record_in_tbl,
17464 x_return_status => x_return_status,
17465 x_msg_data => x_msg_data);
17466 -- dbms_output.put_line( ' attributl email count '||l_emaid_record_in_tbl.COUNT);
17467 FOR l IN 1..l_emaid_record_in_tbl.COUNT LOOP
17468 AMS_IMPORT_XML_PVT.Get_Children_Nodes (
17469 p_imp_xml_element_id => l_emaid_record_in_tbl(l).imp_xml_element_id,
17470 x_child_set => l_emlid_record_in_tbl,
17471 x_return_status => x_return_status,
17472 x_msg_data => x_msg_data);
17473
17474 l_rec := l_customer_tbl.count;
17475 if l > 1 then
17476 l_rec := l_customer_tbl.count+1;
17477 l_customer_tbl(l_rec).cust_data_id := l_rec;
17478
17479
17480 l_customer_tbl(l_rec).per_imp_xml_element_id := l_customer_tbl(l_rec - 1).per_imp_xml_element_id;
17481 l_customer_tbl(l_rec).PERSON_FIRST_NAME := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME;
17482 l_customer_tbl(l_rec).PERSON_LAST_NAME := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME;
17483 l_customer_tbl(l_rec).PERSON_MIDDLE_NAME := l_customer_tbl(l_rec - 1).PERSON_MIDDLE_NAME;
17484 l_customer_tbl(l_rec).PERSON_NAME_SUFFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_SUFFIX;
17485 l_customer_tbl(l_rec).PERSON_NAME_PREFIX := l_customer_tbl(l_rec - 1).PERSON_NAME_PREFIX;
17486 l_customer_tbl(l_rec).SALUTATION := l_customer_tbl(l_rec - 1).SALUTATION;
17487 l_customer_tbl(l_rec).party_id := l_customer_tbl(l_rec - 1).party_id;
17488
17489 l_customer_tbl(l_rec).PERSONAL_INCOME := l_customer_tbl(l_rec - 1).PERSONAL_INCOME;
17490 l_customer_tbl(l_rec).PERSON_ACADEMIC_TITLE := l_customer_tbl(l_rec - 1).PERSON_ACADEMIC_TITLE;
17491 l_customer_tbl(l_rec).PERSON_FIRST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_FIRST_NAME_PHONETIC ;
17492 l_customer_tbl(l_rec).PERSON_LAST_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_LAST_NAME_PHONETIC;
17493 l_customer_tbl(l_rec).MIDDLE_NAME_PHONETIC := l_customer_tbl(l_rec - 1).MIDDLE_NAME_PHONETIC;
17494 l_customer_tbl(l_rec).PERSON_NAME_PHONETIC := l_customer_tbl(l_rec - 1).PERSON_NAME_PHONETIC;
17495 l_customer_tbl(l_rec).PERSON_PREVIOUS_TITLE_NAME := l_customer_tbl(l_rec - 1).PERSON_PREVIOUS_TITLE_NAME ;
17496 l_customer_tbl(l_rec).PLACE_OF_BIRTH := l_customer_tbl(l_rec - 1).PLACE_OF_BIRTH;
17497 l_customer_tbl(l_rec).HEAD_OF_HOUSEHOLD_FLAG := l_customer_tbl(l_rec - 1).HEAD_OF_HOUSEHOLD_FLAG;
17498 l_customer_tbl(l_rec).HOUSEHOLD_SIZE := l_customer_tbl(l_rec - 1).HOUSEHOLD_SIZE;
17499 l_customer_tbl(l_rec).TAX_REFERENCE := l_customer_tbl(l_rec - 1).TAX_REFERENCE;
17500 l_customer_tbl(l_rec).ORIG_SYSTEM_REFERENCE := l_customer_tbl(l_rec - 1).ORIG_SYSTEM_REFERENCE;
17501 l_customer_tbl(l_rec).RENT_OWNED_INDICATOR := l_customer_tbl(l_rec - 1).RENT_OWNED_INDICATOR;
17502 l_customer_tbl(l_rec).PERSON_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE_CATEGORY;
17503 l_customer_tbl(l_rec).DATE_OF_BIRTH := l_customer_tbl(l_rec - 1).DATE_OF_BIRTH;
17504 l_customer_tbl(l_rec).DATE_OF_DEATH := l_customer_tbl(l_rec - 1).DATE_OF_DEATH;
17505 l_customer_tbl(l_rec).DECLARED_ETHNICITY := l_customer_tbl(l_rec - 1).DECLARED_ETHNICITY;
17506 l_customer_tbl(l_rec).MARITAL_STATUS := l_customer_tbl(l_rec - 1).MARITAL_STATUS;
17507 l_customer_tbl(l_rec).MARITAL_STATUS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).MARITAL_STATUS_EFFECTIVE_DATE;
17508 l_customer_tbl(l_rec).PERSON_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE1;
17509 l_customer_tbl(l_rec).PERSON_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE2;
17510 l_customer_tbl(l_rec).PERSON_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE3;
17511 l_customer_tbl(l_rec).PERSON_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE4;
17512 l_customer_tbl(l_rec).PERSON_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE5;
17513 l_customer_tbl(l_rec).PERSON_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE6;
17514 l_customer_tbl(l_rec).PERSON_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE7;
17515 l_customer_tbl(l_rec).PERSON_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE8;
17516 l_customer_tbl(l_rec).PERSON_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE9;
17517 l_customer_tbl(l_rec).PERSON_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE10;
17518 l_customer_tbl(l_rec).PERSON_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE11;
17519 l_customer_tbl(l_rec).PERSON_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE12;
17520 l_customer_tbl(l_rec).PERSON_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE13;
17521 l_customer_tbl(l_rec).PERSON_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE14;
17522 l_customer_tbl(l_rec).PERSON_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).PERSON_ATTRIBUTE15;
17523 l_customer_tbl(l_rec).VEHICLE_RESPONSE_CODE := l_customer_tbl(l_rec - 1).VEHICLE_RESPONSE_CODE;
17524 l_customer_tbl(l_rec).SALES_AGENT_EMAIL_ID := l_customer_tbl(l_rec - 1).SALES_AGENT_EMAIL_ID;
17525 l_customer_tbl(l_rec).NOTES := l_customer_tbl(l_rec - 1).NOTES;
17526
17527
17528 l_customer_tbl(l_rec).add_imp_xml_element_id := l_customer_tbl(l_rec - 1).add_imp_xml_element_id;
17529 l_customer_tbl(l_rec).address1 := l_customer_tbl(l_rec - 1).address1;
17530 l_customer_tbl(l_rec).address2 := l_customer_tbl(l_rec - 1).address2;
17531 l_customer_tbl(l_rec).address3 := l_customer_tbl(l_rec - 1).address3;
17532 l_customer_tbl(l_rec).address4 := l_customer_tbl(l_rec - 1).address4;
17533 l_customer_tbl(l_rec).city := l_customer_tbl(l_rec - 1).city;
17534 l_customer_tbl(l_rec).county := l_customer_tbl(l_rec - 1).county;
17535 l_customer_tbl(l_rec).province := l_customer_tbl(l_rec - 1).province;
17536 l_customer_tbl(l_rec).state := l_customer_tbl(l_rec - 1).state;
17537 l_customer_tbl(l_rec).postal_code := l_customer_tbl(l_rec - 1).postal_code;
17538 l_customer_tbl(l_rec).country := l_customer_tbl(l_rec - 1).country;
17539 l_customer_tbl(l_rec).address_lines_phonetic := l_customer_tbl(l_rec - 1).address_lines_phonetic;
17540 -- bug 4641591: columns obsolete
17541 -- l_customer_tbl(l_rec).po_box_number := l_customer_tbl(l_rec - 1).po_box_number;
17542 -- l_customer_tbl(l_rec).house_number := l_customer_tbl(l_rec - 1).house_number;
17543 -- l_customer_tbl(l_rec).street_suffix := l_customer_tbl(l_rec - 1).street_suffix;
17544 -- l_customer_tbl(l_rec).street := l_customer_tbl(l_rec - 1).street;
17545 -- l_customer_tbl(l_rec).street_number := l_customer_tbl(l_rec - 1).street_number;
17546 -- l_customer_tbl(l_rec).floor := l_customer_tbl(l_rec - 1).floor;
17547 -- l_customer_tbl(l_rec).suite := l_customer_tbl(l_rec - 1).suite;
17548 l_customer_tbl(l_rec).postal_plus4_code := l_customer_tbl(l_rec - 1).postal_plus4_code;
17549 l_customer_tbl(l_rec).identifying_address_flag := l_customer_tbl(l_rec - 1).identifying_address_flag;
17550
17551 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE1 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE1;
17552 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE2 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE2;
17553 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE3 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE3;
17554 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE4 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE4;
17555 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE5 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE5;
17556 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE6 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE6;
17557 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE7 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE7;
17558 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE8 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE8;
17559 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE9 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE9;
17560 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE10 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE10;
17561 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE11 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE11;
17562 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE12 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE12;
17563 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE13 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE13;
17564 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE14 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE14;
17565 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE15 := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE15;
17566 l_customer_tbl(l_rec).DESCRIPTION := l_customer_tbl(l_rec - 1).DESCRIPTION;
17567 l_customer_tbl(l_rec).ADDRESS_ATTRIBUTE_CATEGORY := l_customer_tbl(l_rec - 1).ADDRESS_ATTRIBUTE_CATEGORY;
17568 l_customer_tbl(l_rec).PARTY_SITE_USE := l_customer_tbl(l_rec - 1).PARTY_SITE_USE;
17569 l_customer_tbl(l_rec).LOCATION_DIRECTIONS := l_customer_tbl(l_rec - 1).LOCATION_DIRECTIONS;
17570 l_customer_tbl(l_rec).SHORT_DESCRIPTION := l_customer_tbl(l_rec - 1).SHORT_DESCRIPTION;
17571 l_customer_tbl(l_rec).ADDRESS_EFFECTIVE_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EFFECTIVE_DATE;
17572 l_customer_tbl(l_rec).ADDRESS_EXPIRATION_DATE := l_customer_tbl(l_rec - 1).ADDRESS_EXPIRATION_DATE;
17573
17574 end if;
17575 l_customer_tbl(l_rec).em_imp_xml_element_id := l_emaid_record_in_tbl(l).imp_xml_element_id;
17576 l_customer_tbl(l_rec).email_address := Get_Element_VALUE('EMAIL_ADDRESS',l_emlid_record_in_tbl);
17577 l_rec := 0;
17578 END LOOP; -- Email
17579
17580 -- ******************************Location process
17581
17582 END LOOP; -- Locarion process
17583 p_cust_tbl := l_customer_tbl;
17584
17585 exception
17586 WHEN OTHERS THEN
17587 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
17588 FND_MESSAGE.Set_Token('ROW','Error in Process_b2c_xml_data :' || SQLERRM||' '||SQLCODE);
17589 AMS_Utility_PVT.Create_Log (
17590 x_return_status => x_return_status,
17591 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
17592 p_log_used_by_id => p_import_list_header_id,
17593 p_msg_data => FND_MESSAGE.get,
17594 p_msg_type => 'DEBUG'
17595 );
17596
17597 END Process_b2c_xml_data;
17598 -- -----------------------------------------------------
17599 --
17600 -- This program populates the ams_imp-source_lines table.
17601 --
17602 Procedure Create_b2b_src_lines(
17603 p_import_list_header_id IN number,
17604 p_cust_b2b_tbl in cust_data_in_tbl,
17605 x_return_status OUT NOCOPY varchar2,
17606 x_msg_data OUT NOCOPY varchar2) is
17607
17608 l_batch_id number;
17609 cursor c_batchID is select batch_id from ams_imp_list_headers_all
17610 where import_list_header_id = p_import_list_header_id;
17611
17612 begin
17613 open c_batchID;
17614 fetch c_batchID into l_batch_id;
17615 close c_batchID;
17616 FOR i IN 1..p_cust_b2b_tbl.COUNT LOOP
17617 Insert into AMS_HZ_B2B_MAPPING_V(
17618 IMPORT_SOURCE_LINE_ID,
17619 LAST_UPDATED_BY,
17620 LAST_UPDATE_DATE,
17621 CREATION_DATE,
17622 CREATED_BY,
17623 LAST_UPDATE_LOGIN,
17624 IMPORT_SUCCESSFUL_FLAG,
17625 OBJECT_VERSION_NUMBER,
17626 IMPORT_LIST_HEADER_ID,
17627 LOAD_STATUS,
17628 batch_id,
17629 PARTY_NAME,
17630 FISCAL_YEAREND_MONTH,
17631 DUNS_NUMBER,
17632 EMPLOYEES_TOTAL,
17633 LINE_OF_BUSINESS,
17634 YEAR_ESTABLISHED,
17635 TAX_REFERENCE,
17636 CEO_NAME,
17637 PERSON_FIRST_NAME,
17638 PERSON_MIDDLE_NAME,
17639 PERSON_LAST_NAME,
17640 PERSON_NAME_SUFFIX,
17641 PERSON_NAME_PREFIX,
17642 COUNTRY,
17643 ADDRESS1,
17644 ADDRESS2,
17645 CITY,
17646 COUNTY,
17647 STATE,
17648 PROVINCE,
17649 POSTAL_CODE,
17650 EMAIL_ADDRESS,
17651 PHONE_COUNTRY_CODE,
17652 PHONE_AREA_CODE,
17653 PHONE_NUMBER,
17654 PHONE_EXTENTION,
17655 DEPARTMENT,
17656 JOB_TITLE,
17657 DECISION_MAKER_FLAG,
17658 SIC_CODE,
17659 SIC_CODE_TYPE,
17660 ANALYSIS_FY ,
17661 CURR_FY_POTENTIAL_REVENUE,
17662 NEXT_FY_POTENTIAL_REVENUE,
17663 GSA_INDICATOR_FLAG ,
17664 MISSION_STATEMENT ,
17665 ORGANIZATION_NAME_PHONETIC,
17666 CATEGORY_CODE ,
17667 JGZZ_FISCAL_CODE ,
17668 ADDRESS3 ,
17669 ADDRESS4 ,
17670 ADDRESS_LINES_PHONETIC ,
17671 -- bug 4641591: columns obsolete
17672 -- PO_BOX_NUMBER ,
17673 -- HOUSE_NUMBER ,
17674 -- STREET_SUFFIX ,
17675 -- STREET ,
17676 -- STREET_NUMBER ,
17677 -- FLOOR ,
17678 -- SUITE ,
17679 POSTAL_PLUS4_CODE ,
17680 identifying_address_flag ,
17681 party_id,
17682 org_imp_xml_element_id,
17683 add_imp_xml_element_id,
17684 ocont_imp_xml_element_id,
17685 cp_imp_xml_element_id,
17686 em_imp_xml_element_id,
17687 ADDRESS_EFFECTIVE_DATE,
17688 ADDRESS_EXPIRATION_DATE,
17689 -- ANNUAL_REVENUE,
17690 -- ANNUAL_REVENUE_CURRENCY,
17691 BRANCH_FLAG,
17692 BUSINESS_LINE,
17693 BUSINESS_SCOPE,
17694 CHIEF_EXECUTIVE_TITLE,
17695 CONGRESSIONAL_DISTRICT_CODE,
17696 CONTROL_YEAR,
17697 CORPORATION_CLASS,
17698 CREDIT_SCORE,
17699 CREDIT_SCORE_COMMENTARY,
17700 CUSTOMER_CATEGORY,
17701 DB_RATING,
17702 DATE_OF_BIRTH,
17703 DATE_OF_DEATH,
17704 DEBARMENTS_COUNT,
17705 DEBARTMENTS_DATE,
17706 DECLARED_ETHNICITY,
17707 DEPARTMENT_INDICATOR,
17708 DESCRIPTION,
17709 DISADVANTAGED_INDICATOR,
17710 ENQUIRY_DUNS,
17711 EXPORT_INDICATOR,
17712 FAILURE_SCORE,
17713 FAILURE_SCORE_COMMENTARY,
17714 FAILURE_SCORE_NATL_PERCENTILE,
17715 FAILURE_SCORE_OVERRIDE_CODE,
17716 -- FISCAL_CODE,
17717 GLOBAL_FAILURE_SCORE,
17718 HEADQUARTER_BRANCH_INDICATOR,
17719 HEAD_OF_HOUSEHOLD_FLAG,
17720 HOUSEHOLD_SIZE,
17721 IMPORT_INDICATOR,
17722 ORGANIZATION_KNOWN_AS,
17723 ORGANIZATION_KNOWN_AS2,
17724 ORGANIZATION_KNOWN_AS3,
17725 ORGANIZATION_KNOWN_AS4,
17726 ORGANIZATION_KNOWN_AS5,
17727 PERSON_KNOWN_AS,
17728 PERSON_KNOWN_AS2,
17729 PERSON_KNOWN_AS3,
17730 PERSON_KNOWN_AS4,
17731 PERSON_KNOWN_AS5,
17732 LABOR_SURPLUS_INDICATOR,
17733 LOCAL_ACTIVITY_CODE,
17734 LOCAL_ACTIVITY_CODE_TYPE,
17735 LOCATION_DIRECTIONS,
17736 -- LOCATION_STATUS,
17737 MARITAL_STATUS,
17738 MARITAL_STATUS_EFFECTIVE_DATE,
17739 MINORITY_OWNED_INDICATOR,
17740 MINORITY_OWNED_TYPE,
17741 -- ORGANIZATION_ALIAS,
17742 ORGANIZATION_TYPE,
17743 ORGANIZATION_URL,
17744 OUT_OF_BUSINESS_INDICATOR,
17745 PERSONAL_INCOME,
17746 PERSON_ACADEMIC_TITLE,
17747 PERSON_FIRST_NAME_PHONETIC,
17748 PERSON_LAST_NAME_PHONETIC,
17749 MIDDLE_NAME_PHONETIC,
17750 PERSON_NAME_PHONETIC,
17751 PERSON_PREVIOUS_TITLE_NAME,
17752 PLACE_OF_BIRTH,
17753 -- PREFERRED_NAME,
17754 PRINCIPAL_NAME,
17755 PRINCIPAL_TITLE,
17756 PUBLIC_PRIVATE_OWNERSHIP_FLAG,
17757 RENT_OWNED_INDICATOR,
17758 -- RENT_OWNER_INDICATOR,
17759 -- SECOND_TITLE,
17760 SHORT_DESCRIPTION,
17761 SMALL_BUSINESS_INDICATOR,
17762 TAX_ID,
17763 WOMAN_OWNED_INDICATOR,
17764 ORGANIZATION_ATTRIBUTE1,
17765 ORGANIZATION_ATTRIBUTE2,
17766 ORGANIZATION_ATTRIBUTE3,
17767 ORGANIZATION_ATTRIBUTE4,
17768 ORGANIZATION_ATTRIBUTE5,
17769 ORGANIZATION_ATTRIBUTE6,
17770 ORGANIZATION_ATTRIBUTE7,
17771 ORGANIZATION_ATTRIBUTE8,
17772 ORGANIZATION_ATTRIBUTE9,
17773 ORGANIZATION_ATTRIBUTE10,
17774 ORGANIZATION_ATTRIBUTE11,
17775 ORGANIZATION_ATTRIBUTE12,
17776 ORGANIZATION_ATTRIBUTE13,
17777 ORGANIZATION_ATTRIBUTE14,
17778 ORGANIZATION_ATTRIBUTE15,
17779 ORG_CONTACT_ATTRIBUTE1,
17780 ORG_CONTACT_ATTRIBUTE2,
17781 ORG_CONTACT_ATTRIBUTE3,
17782 ORG_CONTACT_ATTRIBUTE4,
17783 ORG_CONTACT_ATTRIBUTE5,
17784 ORG_CONTACT_ATTRIBUTE6,
17785 ORG_CONTACT_ATTRIBUTE7,
17786 ORG_CONTACT_ATTRIBUTE8,
17787 ORG_CONTACT_ATTRIBUTE9,
17788 ORG_CONTACT_ATTRIBUTE10,
17789 ORG_CONTACT_ATTRIBUTE11,
17790 ORG_CONTACT_ATTRIBUTE12,
17791 ORG_CONTACT_ATTRIBUTE13,
17792 ORG_CONTACT_ATTRIBUTE14,
17793 ORG_CONTACT_ATTRIBUTE15,
17794 ADDRESS_ATTRIBUTE1,
17795 ADDRESS_ATTRIBUTE2,
17796 ADDRESS_ATTRIBUTE3,
17797 ADDRESS_ATTRIBUTE4,
17798 ADDRESS_ATTRIBUTE5,
17799 ADDRESS_ATTRIBUTE6,
17800 ADDRESS_ATTRIBUTE7,
17801 ADDRESS_ATTRIBUTE8,
17802 ADDRESS_ATTRIBUTE9,
17803 ADDRESS_ATTRIBUTE10,
17804 ADDRESS_ATTRIBUTE11,
17805 ADDRESS_ATTRIBUTE12,
17806 ADDRESS_ATTRIBUTE13,
17807 ADDRESS_ATTRIBUTE14,
17808 ADDRESS_ATTRIBUTE15,
17809 ORG_ATTRIBUTE_CATEGORY,
17810 ORG_CONTACT_ATTRIBUTE_CATEGORY,
17811 ADDRESS_ATTRIBUTE_CATEGORY,
17812 PARTY_SITE_USE,
17813 VEHICLE_RESPONSE_CODE,
17814 SALES_AGENT_EMAIL_ADDRESS,
17815 NOTES,
17816 orig_system_reference
17817 )
17818 VALUES
17819 (
17820 ams_imp_source_lines_s.nextval, -- IMPORT_SOURCE_LINE_ID,
17821 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
17822 SYSDATE, -- LAST_UPDATE_DATE,
17823 SYSDATE, -- CREATION_DATE,
17824 FND_GLOBAL.User_ID, -- CREATED_BY,
17825 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
17826 'N',
17827 '1',
17828 p_import_list_header_id,
17829 'ACTIVE',
17830 l_batch_id,
17831 p_cust_b2b_tbl(i).PARTY_NAME,
17832 p_cust_b2b_tbl(i).FISCAL_YEAREND_MONTH,
17833 p_cust_b2b_tbl(i).DUNS_NUMBER,
17834 p_cust_b2b_tbl(i).EMPLOYEES_TOTAL,
17835 p_cust_b2b_tbl(i).LINE_OF_BUSINESS,
17836 p_cust_b2b_tbl(i).YEAR_ESTABLISHED,
17837 p_cust_b2b_tbl(i).TAX_REFERENCE,
17838 p_cust_b2b_tbl(i).CEO_NAME,
17839 p_cust_b2b_tbl(i).PERSON_FIRST_NAME,
17840 p_cust_b2b_tbl(i).PERSON_MIDDLE_NAME,
17841 p_cust_b2b_tbl(i).PERSON_LAST_NAME,
17842 p_cust_b2b_tbl(i).PERSON_NAME_SUFFIX,
17843 p_cust_b2b_tbl(i).PERSON_NAME_PREFIX,
17844 p_cust_b2b_tbl(i).COUNTRY,
17845 p_cust_b2b_tbl(i).ADDRESS1,
17846 p_cust_b2b_tbl(i).ADDRESS2,
17847 p_cust_b2b_tbl(i).CITY,
17848 p_cust_b2b_tbl(i).COUNTY,
17849 p_cust_b2b_tbl(i).STATE,
17850 p_cust_b2b_tbl(i).PROVINCE,
17851 p_cust_b2b_tbl(i).POSTAL_CODE,
17852 p_cust_b2b_tbl(i).EMAIL_ADDRESS,
17853 p_cust_b2b_tbl(i).PHONE_COUNTRY_CODE,
17854 p_cust_b2b_tbl(i).PHONE_AREA_CODE,
17855 p_cust_b2b_tbl(i).PHONE_NUMBER,
17856 p_cust_b2b_tbl(i).PHONE_EXTENSION,
17857 p_cust_b2b_tbl(i).DEPARTMENT,
17858 p_cust_b2b_tbl(i).JOB_TITLE,
17859 p_cust_b2b_tbl(i).DECISION_MAKER_FLAG,
17860 p_cust_b2b_tbl(i).SIC_CODE,
17861 p_cust_b2b_tbl(i).SIC_CODE_TYPE,
17862 p_cust_b2b_tbl(i).ANALYSIS_FY ,
17863 p_cust_b2b_tbl(i).CURR_FY_POTENTIAL_REVENUE,
17864 p_cust_b2b_tbl(i).NEXT_FY_POTENTIAL_REVENUE,
17865 p_cust_b2b_tbl(i).GSA_INDICATOR_FLAG ,
17866 p_cust_b2b_tbl(i).MISSION_STATEMENT ,
17867 p_cust_b2b_tbl(i).ORGANIZATION_NAME_PHONETIC,
17868 p_cust_b2b_tbl(i).CATEGORY_CODE ,
17869 p_cust_b2b_tbl(i).JGZZ_FISCAL_CODE ,
17870 p_cust_b2b_tbl(i).ADDRESS3 ,
17871 p_cust_b2b_tbl(i).ADDRESS4 ,
17872 p_cust_b2b_tbl(i).ADDRESS_LINES_PHONETIC ,
17873 -- bug 4641591: columns obsolete
17874 -- p_cust_b2b_tbl(i).PO_BOX_NUMBER ,
17875 -- p_cust_b2b_tbl(i).HOUSE_NUMBER ,
17876 -- p_cust_b2b_tbl(i).STREET_SUFFIX ,
17877 -- p_cust_b2b_tbl(i).STREET ,
17878 -- p_cust_b2b_tbl(i).STREET_NUMBER ,
17879 -- p_cust_b2b_tbl(i).FLOOR ,
17880 -- p_cust_b2b_tbl(i).SUITE ,
17881 p_cust_b2b_tbl(i).POSTAL_PLUS4_CODE ,
17882 p_cust_b2b_tbl(i).identifying_address_flag ,
17883 p_cust_b2b_tbl(i).party_id,
17884 p_cust_b2b_tbl(i).org_imp_xml_element_id,
17885 p_cust_b2b_tbl(i).add_imp_xml_element_id,
17886 p_cust_b2b_tbl(i).ocont_imp_xml_element_id,
17887 p_cust_b2b_tbl(i).cp_imp_xml_element_id,
17888 p_cust_b2b_tbl(i).em_imp_xml_element_id,
17889 p_cust_b2b_tbl(i).ADDRESS_EFFECTIVE_DATE,
17890 p_cust_b2b_tbl(i).ADDRESS_EXPIRATION_DATE,
17891 -- p_cust_b2b_tbl(i).ANNUAL_REVENUE,
17892 -- p_cust_b2b_tbl(i).ANNUAL_REVENUE_CURRENCY,
17893 p_cust_b2b_tbl(i).BRANCH_FLAG,
17894 p_cust_b2b_tbl(i).BUSINESS_LINE,
17895 p_cust_b2b_tbl(i).BUSINESS_SCOPE,
17896 p_cust_b2b_tbl(i).CHIEF_EXECUTIVE_TITLE,
17897 p_cust_b2b_tbl(i).CONGRESSIONAL_DISTRICT_CODE,
17898 p_cust_b2b_tbl(i).CONTROL_YEAR,
17899 p_cust_b2b_tbl(i).CORPORATION_CLASS,
17900 p_cust_b2b_tbl(i).CREDIT_SCORE,
17901 p_cust_b2b_tbl(i).CREDIT_SCORE_COMMENTARY,
17902 p_cust_b2b_tbl(i).CUSTOMER_CATEGORY,
17903 p_cust_b2b_tbl(i).DB_RATING,
17904 p_cust_b2b_tbl(i).DATE_OF_BIRTH,
17905 p_cust_b2b_tbl(i).DATE_OF_DEATH,
17906 p_cust_b2b_tbl(i).DEBARMENTS_COUNT,
17907 p_cust_b2b_tbl(i).DEBARTMENTS_DATE,
17908 p_cust_b2b_tbl(i).DECLARED_ETHNICITY,
17909 p_cust_b2b_tbl(i).DEPARTMENT_INDICATOR,
17910 p_cust_b2b_tbl(i).DESCRIPTION,
17911 p_cust_b2b_tbl(i).DISADVANTAGED_INDICATOR,
17912 p_cust_b2b_tbl(i).ENQUIRY_DUNS,
17913 p_cust_b2b_tbl(i).EXPORT_INDICATOR,
17914 p_cust_b2b_tbl(i).FAILURE_SCORE,
17915 p_cust_b2b_tbl(i).FAILURE_SCORE_COMMENTARY,
17916 p_cust_b2b_tbl(i).FAILURE_SCORE_NATL_PERCENTILE,
17917 p_cust_b2b_tbl(i).FAILURE_SCORE_OVERRIDE_CODE,
17918 -- p_cust_b2b_tbl(i).FISCAL_CODE,
17919 p_cust_b2b_tbl(i).GLOBAL_FAILURE_SCORE,
17920 p_cust_b2b_tbl(i).HEADQUARTER_BRANCH_INDICATOR,
17921 p_cust_b2b_tbl(i).HEAD_OF_HOUSEHOLD_FLAG,
17922 p_cust_b2b_tbl(i).HOUSEHOLD_SIZE,
17923 p_cust_b2b_tbl(i).IMPORT_INDICATOR,
17924 p_cust_b2b_tbl(i).ORGANIZATION_KNOWN_AS,
17925 p_cust_b2b_tbl(i).ORGANIZATION_KNOWN_AS2,
17926 p_cust_b2b_tbl(i).ORGANIZATION_KNOWN_AS3,
17927 p_cust_b2b_tbl(i).ORGANIZATION_KNOWN_AS4,
17928 p_cust_b2b_tbl(i).ORGANIZATION_KNOWN_AS5,
17929 p_cust_b2b_tbl(i).PERSON_KNOWN_AS,
17930 p_cust_b2b_tbl(i).PERSON_KNOWN_AS2,
17931 p_cust_b2b_tbl(i).PERSON_KNOWN_AS3,
17932 p_cust_b2b_tbl(i).PERSON_KNOWN_AS4,
17933 p_cust_b2b_tbl(i).PERSON_KNOWN_AS5,
17934 p_cust_b2b_tbl(i).LABOR_SURPLUS_INDICATOR,
17935 p_cust_b2b_tbl(i).LOCAL_ACTIVITY_CODE,
17936 p_cust_b2b_tbl(i).LOCAL_ACTIVITY_CODE_TYPE,
17937 p_cust_b2b_tbl(i).LOCATION_DIRECTIONS,
17938 -- p_cust_b2b_tbl(i).LOCATION_STATUS,
17939 p_cust_b2b_tbl(i).MARITAL_STATUS,
17940 p_cust_b2b_tbl(i).MARITAL_STATUS_EFFECTIVE_DATE,
17941 p_cust_b2b_tbl(i).MINORITY_OWNED_INDICATOR,
17942 p_cust_b2b_tbl(i).MINORITY_OWNED_TYPE,
17943 -- p_cust_b2b_tbl(i).ORGANIZATION_ALIAS,
17944 p_cust_b2b_tbl(i).ORGANIZATION_TYPE,
17945 p_cust_b2b_tbl(i).ORGANIZATION_URL,
17946 p_cust_b2b_tbl(i).OUT_OF_BUSINESS_INDICATOR,
17947 p_cust_b2b_tbl(i).PERSONAL_INCOME,
17948 p_cust_b2b_tbl(i).PERSON_ACADEMIC_TITLE,
17949 p_cust_b2b_tbl(i).PERSON_FIRST_NAME_PHONETIC,
17950 p_cust_b2b_tbl(i).PERSON_LAST_NAME_PHONETIC,
17951 p_cust_b2b_tbl(i).MIDDLE_NAME_PHONETIC,
17952 p_cust_b2b_tbl(i).PERSON_NAME_PHONETIC,
17953 p_cust_b2b_tbl(i).PERSON_PREVIOUS_TITLE_NAME,
17954 p_cust_b2b_tbl(i).PLACE_OF_BIRTH,
17955 -- p_cust_b2b_tbl(i).PREFERRED_NAME,
17956 p_cust_b2b_tbl(i).PRINCIPAL_NAME,
17957 p_cust_b2b_tbl(i).PRINCIPAL_TITLE,
17958 p_cust_b2b_tbl(i).PUBLIC_PRIVATE_OWNERSHIP_FLAG,
17959 p_cust_b2b_tbl(i).RENT_OWNED_INDICATOR,
17960 -- p_cust_b2b_tbl(i).RENT_OWNER_INDICATOR,
17961 -- p_cust_b2b_tbl(i).SECOND_TITLE,
17962 p_cust_b2b_tbl(i).SHORT_DESCRIPTION,
17963 p_cust_b2b_tbl(i).SMALL_BUSINESS_INDICATOR,
17964 p_cust_b2b_tbl(i).TAX_ID,
17965 p_cust_b2b_tbl(i).WOMAN_OWNED_INDICATOR,
17966 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE1,
17967 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE2,
17968 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE3,
17969 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE4,
17970 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE5,
17971 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE6,
17972 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE7,
17973 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE8,
17974 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE9,
17975 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE10,
17976 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE11,
17977 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE12,
17978 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE13,
17979 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE14,
17980 p_cust_b2b_tbl(i).ORGANIZATION_ATTRIBUTE15,
17981 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE1,
17982 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE2,
17983 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE3,
17984 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE4,
17985 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE5,
17986 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE6,
17987 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE7,
17988 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE8,
17989 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE9,
17990 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE10,
17991 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE11,
17992 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE12,
17993 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE13,
17994 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE14,
17995 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE15,
17996 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE1,
17997 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE2,
17998 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE3,
17999 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE4,
18000 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE5,
18001 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE6,
18002 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE7,
18003 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE8,
18004 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE9,
18005 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE10,
18006 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE11,
18007 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE12,
18008 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE13,
18009 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE14,
18010 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE15,
18011 p_cust_b2b_tbl(i).ORG_ATTRIBUTE_CATEGORY,
18012 p_cust_b2b_tbl(i).ORG_CONTACT_ATTRIBUTE_CATEGORY,
18013 p_cust_b2b_tbl(i).ADDRESS_ATTRIBUTE_CATEGORY,
18014 p_cust_b2b_tbl(i).PARTY_SITE_USE,
18015 p_cust_b2b_tbl(i).VEHICLE_RESPONSE_CODE,
18016 p_cust_b2b_tbl(i).SALES_AGENT_EMAIL_ID,
18017 p_cust_b2b_tbl(i).NOTES,
18018 p_cust_b2b_tbl(i).orig_system_reference
18019 );
18020 END LOOP;
18021 commit;
18022
18023 exception
18024 WHEN OTHERS THEN
18025 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
18026 FND_MESSAGE.Set_Token('ROW','Error in Create_b2b_src_lines:' || SQLERRM||' '||SQLCODE);
18027 AMS_Utility_PVT.Create_Log (
18028 x_return_status => x_return_status,
18029 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
18030 p_log_used_by_id => p_import_list_header_id,
18031 p_msg_data => FND_MESSAGE.get,
18032 p_msg_type => 'DEBUG'
18033 );
18034
18035 end Create_b2b_src_lines;
18036 -- -------------------------------------------------------------------
18037 --
18038 -- This program populates the ams_imp-source_lines table.
18039 --
18040 Procedure Create_b2c_src_lines(
18041 p_import_list_header_id IN number,
18042 p_cust_b2c_tbl in cust_b2c_data_in_tbl,
18043 x_return_status OUT NOCOPY varchar2,
18044 x_msg_data OUT NOCOPY varchar2) IS
18045
18046 l_batch_id number;
18047 cursor c_batchID is select batch_id from ams_imp_list_headers_all
18048 where import_list_header_id = p_import_list_header_id;
18049
18050 begin
18051 open c_batchID;
18052 fetch c_batchID into l_batch_id;
18053 close c_batchID;
18054 FOR i IN 1..p_cust_b2c_tbl.COUNT LOOP
18055 Insert into AMS_HZ_B2C_MAPPING_V(
18056 IMPORT_SOURCE_LINE_ID,
18057 LAST_UPDATED_BY,
18058 LAST_UPDATE_DATE,
18059 CREATION_DATE,
18060 CREATED_BY,
18061 LAST_UPDATE_LOGIN,
18062 IMPORT_SUCCESSFUL_FLAG,
18063 OBJECT_VERSION_NUMBER,
18064 IMPORT_LIST_HEADER_ID,
18065 LOAD_STATUS,
18066 batch_id,
18067 PERSON_FIRST_NAME,
18068 PERSON_MIDDLE_NAME,
18069 PERSON_LAST_NAME,
18070 PERSON_NAME_SUFFIX,
18071 PERSON_NAME_PREFIX,
18072 -- PERSON_PRE_NAME_ADJUNCT,
18073 SALUTATION,
18074 COUNTRY,
18075 ADDRESS1,
18076 ADDRESS2,
18077 CITY,
18078 COUNTY,
18079 STATE,
18080 PROVINCE,
18081 POSTAL_CODE,
18082 EMAIL_ADDRESS,
18083 PHONE_COUNTRY_CODE,
18084 PHONE_AREA_CODE,
18085 PHONE_NUMBER,
18086 PHONE_EXTENTION,
18087 ADDRESS3 ,
18088 ADDRESS4 ,
18089 ADDRESS_LINES_PHONETIC ,
18090 -- bug 4641591: columns obsolete
18091 -- PO_BOX_NUMBER ,
18092 -- HOUSE_NUMBER ,
18093 -- STREET_SUFFIX ,
18094 -- STREET ,
18095 -- STREET_NUMBER ,
18096 -- FLOOR ,
18097 -- SUITE ,
18098 POSTAL_PLUS4_CODE ,
18099 identifying_address_flag ,
18100 party_id,
18101 per_imp_xml_element_id,
18102 add_imp_xml_element_id,
18103 cp_imp_xml_element_id,
18104 em_imp_xml_element_id,
18105 PERSON_LAST_NAME_PHONETIC,
18106 PERSON_FIRST_NAME_PHONETIC,
18107 URL,
18108 DATE_OF_BIRTH,
18109 PERSON_ACADEMIC_TITLE,
18110 PERSON_PREVIOUS_TITLE_NAME,
18111 PERSON_KNOWN_AS,
18112 PERSON_KNOWN_AS2,
18113 PERSON_KNOWN_AS3,
18114 PERSON_KNOWN_AS4,
18115 PERSON_KNOWN_AS5,
18116 PERSON_NAME_PHONETIC,
18117 MIDDLE_NAME_PHONETIC,
18118 FISCAL_CODE,
18119 PLACE_OF_BIRTH,
18120 DATE_OF_DEATH,
18121 DECLARED_ETHNICITY,
18122 MARITAL_STATUS,
18123 PERSONAL_INCOME,
18124 MARITAL_STATUS_EFFECTIVE_DATE,
18125 HEAD_OF_HOUSEHOLD_FLAG,
18126 HOUSEHOLD_SIZE,
18127 LOCATION_DIRECTIONS,
18128 ADDRESS_EFFECTIVE_DATE,
18129 ADDRESS_EXPIRATION_DATE,
18130 PERSON_ATTRIBUTE1,
18131 PERSON_ATTRIBUTE2,
18132 PERSON_ATTRIBUTE3,
18133 PERSON_ATTRIBUTE4,
18134 PERSON_ATTRIBUTE5,
18135 PERSON_ATTRIBUTE6,
18136 PERSON_ATTRIBUTE7,
18137 PERSON_ATTRIBUTE8,
18138 PERSON_ATTRIBUTE9,
18139 PERSON_ATTRIBUTE10,
18140 PERSON_ATTRIBUTE11,
18141 PERSON_ATTRIBUTE12,
18142 PERSON_ATTRIBUTE13,
18143 PERSON_ATTRIBUTE14,
18144 PERSON_ATTRIBUTE15,
18145 ADDRESS_ATTRIBUTE1,
18146 ADDRESS_ATTRIBUTE2,
18147 ADDRESS_ATTRIBUTE3,
18148 ADDRESS_ATTRIBUTE4,
18149 ADDRESS_ATTRIBUTE5,
18150 ADDRESS_ATTRIBUTE6,
18151 ADDRESS_ATTRIBUTE7,
18152 ADDRESS_ATTRIBUTE8,
18153 ADDRESS_ATTRIBUTE9,
18154 ADDRESS_ATTRIBUTE10,
18155 ADDRESS_ATTRIBUTE11,
18156 ADDRESS_ATTRIBUTE12,
18157 ADDRESS_ATTRIBUTE13,
18158 ADDRESS_ATTRIBUTE14,
18159 ADDRESS_ATTRIBUTE15,
18160 PERSON_ATTRIBUTE_CATEGORY,
18161 ADDRESS_ATTRIBUTE_CATEGORY,
18162 PARTY_SITE_USE,
18163 SHORT_DESCRIPTION,
18164 DESCRIPTION,
18165 VEHICLE_RESPONSE_CODE,
18166 SALES_AGENT_EMAIL_ADDRESS,
18167 NOTES,
18168 orig_system_reference,
18169 tax_reference,
18170 rent_owned_indicator
18171 )
18172 VALUES
18173 (
18174 ams_imp_source_lines_s.nextval, -- IMPORT_SOURCE_LINE_ID,
18175 FND_GLOBAL.User_ID, -- LAST_UPDATED_BY,
18176 SYSDATE, -- LAST_UPDATE_DATE,
18177 SYSDATE, -- CREATION_DATE,
18178 FND_GLOBAL.User_ID, -- CREATED_BY,
18179 FND_GLOBAL.Conc_Login_ID, -- LAST_UPDATE_LOGIN,
18180 'N',
18181 '1',
18182 p_import_list_header_id,
18183 'ACTIVE',
18184 l_batch_id,
18185 p_cust_b2c_tbl(i).PERSON_FIRST_NAME,
18186 p_cust_b2c_tbl(i).PERSON_MIDDLE_NAME,
18187 p_cust_b2c_tbl(i).PERSON_LAST_NAME,
18188 p_cust_b2c_tbl(i).PERSON_NAME_SUFFIX,
18189 p_cust_b2c_tbl(i).PERSON_NAME_PREFIX,
18190 -- p_cust_b2c_tbl(i).PERSON_PRE_NAME_ADJUNCT,
18191 p_cust_b2c_tbl(i).salutation,
18192 p_cust_b2c_tbl(i).COUNTRY,
18193 p_cust_b2c_tbl(i).ADDRESS1,
18194 p_cust_b2c_tbl(i).ADDRESS2,
18195 p_cust_b2c_tbl(i).CITY,
18196 p_cust_b2c_tbl(i).COUNTY,
18197 p_cust_b2c_tbl(i).STATE,
18198 p_cust_b2c_tbl(i).PROVINCE,
18199 p_cust_b2c_tbl(i).POSTAL_CODE,
18200 p_cust_b2c_tbl(i).EMAIL_ADDRESS,
18201 p_cust_b2c_tbl(i).PHONE_COUNTRY_CODE,
18202 p_cust_b2c_tbl(i).PHONE_AREA_CODE,
18203 p_cust_b2c_tbl(i).PHONE_NUMBER,
18204 p_cust_b2c_tbl(i).PHONE_EXTENSION,
18205 p_cust_b2c_tbl(i).ADDRESS3 ,
18206 p_cust_b2c_tbl(i).ADDRESS4 ,
18207 p_cust_b2c_tbl(i).ADDRESS_LINES_PHONETIC ,
18208 -- bug 4641591: columns obsolete
18209 -- p_cust_b2c_tbl(i).PO_BOX_NUMBER ,
18210 -- p_cust_b2c_tbl(i).HOUSE_NUMBER ,
18211 -- p_cust_b2c_tbl(i).STREET_SUFFIX ,
18212 -- p_cust_b2c_tbl(i).STREET ,
18213 -- p_cust_b2c_tbl(i).STREET_NUMBER ,
18214 -- p_cust_b2c_tbl(i).FLOOR ,
18215 -- p_cust_b2c_tbl(i).SUITE ,
18216 p_cust_b2c_tbl(i).POSTAL_PLUS4_CODE ,
18217 p_cust_b2c_tbl(i).identifying_address_flag ,
18218 p_cust_b2c_tbl(i).party_id,
18219 p_cust_b2c_tbl(i).per_imp_xml_element_id,
18220 p_cust_b2c_tbl(i).add_imp_xml_element_id,
18221 p_cust_b2c_tbl(i).cp_imp_xml_element_id,
18222 p_cust_b2c_tbl(i).em_imp_xml_element_id,
18223 p_cust_b2c_tbl(i).PERSON_LAST_NAME_PHONETIC,
18224 p_cust_b2c_tbl(i).PERSON_FIRST_NAME_PHONETIC,
18225 p_cust_b2c_tbl(i).URL,
18226 p_cust_b2c_tbl(i).DATE_OF_BIRTH,
18227 p_cust_b2c_tbl(i).PERSON_ACADEMIC_TITLE,
18228 p_cust_b2c_tbl(i).PERSON_PREVIOUS_TITLE_NAME,
18229 p_cust_b2c_tbl(i).PERSON_KNOWN_AS,
18230 p_cust_b2c_tbl(i).PERSON_KNOWN_AS2,
18231 p_cust_b2c_tbl(i).PERSON_KNOWN_AS3,
18232 p_cust_b2c_tbl(i).PERSON_KNOWN_AS4,
18233 p_cust_b2c_tbl(i).PERSON_KNOWN_AS5,
18234 p_cust_b2c_tbl(i).PERSON_NAME_PHONETIC,
18235 p_cust_b2c_tbl(i).MIDDLE_NAME_PHONETIC,
18236 p_cust_b2c_tbl(i).FISCAL_CODE,
18237 p_cust_b2c_tbl(i).PLACE_OF_BIRTH,
18238 p_cust_b2c_tbl(i).DATE_OF_DEATH,
18239 p_cust_b2c_tbl(i).DECLARED_ETHNICITY,
18240 p_cust_b2c_tbl(i).MARITAL_STATUS,
18241 p_cust_b2c_tbl(i).PERSONAL_INCOME,
18242 p_cust_b2c_tbl(i).MARITAL_STATUS_EFFECTIVE_DATE,
18243 p_cust_b2c_tbl(i).HEAD_OF_HOUSEHOLD_FLAG,
18244 p_cust_b2c_tbl(i).HOUSEHOLD_SIZE,
18245 p_cust_b2c_tbl(i).LOCATION_DIRECTIONS,
18246 p_cust_b2c_tbl(i).ADDRESS_EFFECTIVE_DATE,
18247 p_cust_b2c_tbl(i).ADDRESS_EXPIRATION_DATE,
18248 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE1,
18249 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE2,
18250 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE3,
18251 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE4,
18252 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE5,
18253 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE6,
18254 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE7,
18255 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE8,
18256 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE9,
18257 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE10,
18258 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE11,
18259 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE12,
18260 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE13,
18261 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE14,
18262 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE15,
18263 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE1,
18264 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE2,
18265 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE3,
18266 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE4,
18267 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE5,
18268 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE6,
18269 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE7,
18270 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE8,
18271 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE9,
18272 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE10,
18273 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE11,
18274 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE12,
18275 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE13,
18276 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE14,
18277 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE15,
18278 p_cust_b2c_tbl(i).PERSON_ATTRIBUTE_CATEGORY,
18279 p_cust_b2c_tbl(i).ADDRESS_ATTRIBUTE_CATEGORY,
18280 p_cust_b2c_tbl(i).PARTY_SITE_USE,
18281 p_cust_b2c_tbl(i).SHORT_DESCRIPTION,
18282 p_cust_b2c_tbl(i).DESCRIPTION,
18283 p_cust_b2c_tbl(i).VEHICLE_RESPONSE_CODE,
18284 p_cust_b2c_tbl(i).SALES_AGENT_EMAIL_ID,
18285 p_cust_b2c_tbl(i).NOTES,
18286 p_cust_b2c_tbl(i).orig_system_reference,
18287 p_cust_b2c_tbl(i).tax_reference,
18288 p_cust_b2c_tbl(i).rent_owned_indicator
18289 );
18290 END LOOP;
18291 commit;
18292
18293 exception
18294 WHEN OTHERS THEN
18295 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
18296 FND_MESSAGE.Set_Token('ROW','Error in Create_b2c_src_lines:' || SQLERRM||' '||SQLCODE);
18297 AMS_Utility_PVT.Create_Log (
18298 x_return_status => x_return_status,
18299 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
18300 p_log_used_by_id => p_import_list_header_id,
18301 p_msg_data => FND_MESSAGE.get,
18302 p_msg_type => 'DEBUG'
18303 );
18304
18305 end Create_b2c_src_lines;
18306
18307 --
18308 -- for XML updates the error in the element table
18309 --
18310 PROCEDURE update_element_error (
18311 p_import_list_header_id IN NUMBER,
18312 p_xml_element_id IN NUMBER,
18313 p_colName IN varchar2,
18314 p_error_text IN varchar2) IS
18315
18316 x_return_status VARCHAR2(1);
18317 x_msg_data VARCHAR2(2000);
18318 l_error_exist VARCHAR2(1);
18319 cursor c_error_text is
18320 select 'Y' from AMS_IMP_XML_ELEMENTS where IMP_XML_ELEMENT_ID = p_xml_element_id
18321 and error_text like '%'||p_colName||'%';
18322 begin
18323 open c_error_text;
18324 fetch c_error_text into l_error_exist;
18325 close c_error_text;
18326 if l_error_exist is NULL then
18327 update AMS_IMP_XML_ELEMENTS
18328 set ERROR_TEXT = substr((ERROR_TEXT ||','||p_error_text),1,4000),
18329 LOAD_STATUS = 'ERROR'
18330 where imp_xml_element_id = p_xml_element_id;
18331 end if;
18332 exception
18333 WHEN OTHERS THEN
18334 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
18335 FND_MESSAGE.Set_Token('ROW','Error in update_element_error :' || SQLERRM||' '||SQLCODE);
18336 AMS_Utility_PVT.Create_Log (
18337 x_return_status => x_return_status,
18338 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
18339 p_log_used_by_id => p_import_list_header_id,
18340 p_msg_data => FND_MESSAGE.get,
18341 p_msg_type => 'DEBUG'
18342 );
18343
18344
18345 end update_element_error;
18346
18347
18348 --
18349 -- This procedure is used to create party site use
18350 --
18351
18352 procedure create_party_site_use (
18353 p_psiteuse_rec IN hz_party_site_v2pub.party_site_use_rec_type,
18354 x_return_status OUT NOCOPY VARCHAR2,
18355 x_msg_count OUT NOCOPY NUMBER,
18356 x_msg_data OUT NOCOPY VARCHAR2,
18357 x_party_site_use_id OUT NOCOPY NUMBER
18358 ) IS
18359
18360 psiteuse_rec hz_party_site_v2pub.party_site_use_rec_type := p_psiteuse_rec;
18361
18362 begin
18363
18364 psiteuse_rec.CREATED_BY_MODULE := 'AMS_LIST_IMPORT';
18365 psiteuse_rec.application_id := 530;
18366 hz_party_site_v2pub.create_party_site_use(
18367 'F',
18368 psiteuse_rec,
18369 x_party_site_use_id,
18370 x_return_status,
18371 x_msg_count,
18372 x_msg_data
18373 );
18374 end create_party_site_use;
18375 -- -------------------------------------------------------
18376
18377
18378 --
18379 -- This procedure creates list notes from import
18380 --
18381 --
18382 PROCEDURE create_list_note
18383 ( p_import_list_header_id in number,
18384 p_import_source_line_id in number,
18385 p_party_id in number,
18386 p_source_object_code in varchar2,
18387 p_note_text in varchar2,
18388 x_return_status OUT NOCOPY VARCHAR2,
18389 x_msg_count OUT NOCOPY NUMBER,
18390 x_msg_data OUT NOCOPY VARCHAR2
18391 ) IS
18392
18393 l_api_version NUMBER;
18394 l_init_msg_list VARCHAR2(1);
18395 l_validation_level NUMBER;
18396 l_commit VARCHAR2(1);
18397 l_return_status VARCHAR2(1);
18398 l_msg_count NUMBER;
18399 l_msg_data VARCHAR2(2000);
18400 l_jtf_note_id NUMBER;
18401 l_source_object_id NUMBER;
18402 l_source_object_code VARCHAR2(8);
18403 l_note_status VARCHAR2(8);
18404 l_note_type VARCHAR2(80);
18405 l_notes VARCHAR2(2000);
18406 l_notes_detail VARCHAR2(8000);
18407 l_last_update_date DATE;
18408 l_last_updated_by NUMBER;
18409 l_creation_date DATE;
18410 l_created_by NUMBER;
18411 l_last_update_login NUMBER;
18412 l_entered_by NUMBER;
18413 l_entered_date DATE;
18414 l_note_contexts JTF_NOTES_PUB.jtf_note_contexts_tbl_type;
18415 l_msg_index NUMBER;
18416 l_msg_index_out NUMBER;
18417
18418 x_tmp_var VARCHAR2(4000);
18419 x_tmp_var1 VARCHAR2(4000);
18420 L_NOTE_CONTEXT_ID NUMBER;
18421
18422 begin
18423
18424 --==============================================================
18425 -- INITIALIZE THE API STATIC VALUES ===
18426 --==============================================================
18427 l_api_version := 1.0;
18428 l_init_msg_list := FND_API.g_true;
18429 l_validation_level := FND_API.g_valid_level_full;
18430 l_commit := FND_API.g_true;
18431 l_msg_count := 0;
18432 l_source_object_code := nvl(p_source_object_code,'PARTY');
18433 l_note_status := 'I';
18434 l_note_type := 'AS_USER';
18435 l_last_update_date := SYSDATE;
18436 l_last_updated_by := FND_GLOBAL.user_id; --LEADS_US
18437 l_last_update_login := FND_GLOBAL.conc_login_id; --LEADS_US
18438 l_jtf_note_id := null;
18439 --============================================================
18440 --== SET THE API VARIABLE VALUES ===
18441 --============================================================
18442 l_source_object_id := p_party_id;
18443 l_notes := p_note_text;
18444 l_notes_detail := p_note_text;
18445 l_creation_date := sysdate;
18446 l_created_by := FND_GLOBAL.user_id; --LEADS_US
18447 l_entered_date := sysdate;
18448 l_entered_by := FND_GLOBAL.user_id; --LEADS_US
18449
18450
18451 --============================================================
18452 --== CALL THE API to create a note ===
18453 --============================================================
18454 jtf_notes_pub.Create_note
18455 (
18456 p_api_version => l_api_version
18457 ,p_init_msg_list => l_init_msg_list
18458 ,p_commit => l_commit
18459 ,p_validation_level => l_validation_level
18460 ,x_return_status => x_return_status
18461 ,x_msg_count => x_msg_count
18462 ,x_msg_data => x_msg_data
18463 ,p_jtf_note_id => l_jtf_note_id
18464 ,p_entered_by => l_entered_by
18465 ,p_entered_date => l_entered_date
18466 ,p_source_object_id => l_source_object_id
18467 ,p_source_object_code => l_source_object_code
18468 ,p_notes => l_notes
18469 ,p_notes_detail => l_notes_detail
18470 ,p_note_type => l_note_type
18471 ,p_note_status => l_note_status
18472 ,p_jtf_note_contexts_tab => l_note_contexts
18473 ,x_jtf_note_id => l_jtf_note_id
18474 ,p_last_update_date => l_last_update_date
18475 ,p_last_updated_by => l_last_updated_by
18476 ,p_creation_date => l_creation_date
18477 ,p_created_by => l_created_by
18478 ,p_last_update_login => l_last_update_login
18479 );
18480 if x_msg_count > 1 then
18481 FOR i IN 1..x_msg_count LOOP
18482 x_tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
18483 x_tmp_var1 := substrb(x_tmp_var1 || ' '|| x_tmp_var,1,4000);
18484 END LOOP;
18485 END IF;
18486 if x_return_status <> 'S' then
18487 AMS_List_Import_PUB.error_capture (
18488 1, 'T', 'F', null,
18489 x_return_status,
18490 x_msg_count,
18491 x_msg_data,
18492 p_import_list_header_id,
18493 p_import_source_line_id,
18494 null, null, null,null,
18495 'Error in create_list_note :' || SQLERRM||' '||SQLCODE);
18496 return;
18497 end if;
18498 exception
18499 WHEN OTHERS THEN
18500 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
18501 FND_MESSAGE.Set_Token('ROW','Error in create_list_note :' || SQLERRM||' '||SQLCODE);
18502 AMS_Utility_PVT.Create_Log (
18503 x_return_status => l_return_status,
18504 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
18505 p_log_used_by_id => p_import_list_header_id,
18506 p_msg_data => FND_MESSAGE.get,
18507 p_msg_type => 'DEBUG'
18508 );
18509 update ams_imp_source_lines set load_status = 'ERROR'
18510 where import_list_header_id = p_import_list_header_id
18511 and load_status in ('ACTIVE','RELOAD');
18512
18513 AMS_List_Import_PUB.error_capture (
18514 1, 'T', 'F', null,
18515 x_return_status,
18516 x_msg_count,
18517 x_msg_data,
18518 p_import_list_header_id,
18519 p_import_source_line_id,
18520 null, null, null,null,
18521 'Error in create_list_note :' || SQLERRM||' '||SQLCODE);
18522 x_return_status := 'E';
18523
18524 end create_list_note;
18525
18526 -- --------------------------------------------------------------------------
18527 --
18528 -- This procedure is used for existence checking for import process
18529 --
18530 --
18531 PROCEDURE org_existence_checking(
18532 p_import_list_header_id IN NUMBER,
18533 x_return_status OUT NOCOPY VARCHAR2,
18534 x_msg_count OUT NOCOPY NUMBER,
18535 x_msg_data OUT NOCOPY VARCHAR2
18536 ) IS
18537 l_limit_rows number := 1000;
18538 l_last_fetch BOOLEAN;
18539 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
18540 TYPE ORG_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ORG_KEY%TYPE;
18541 TYPE ORG_EXIST_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ORG_EXIST%TYPE;
18542 TYPE ORG_PARTY_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ORG_PARTY_ID%TYPE;
18543 TYPE PARTY_NAME_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.COL1%TYPE;
18544
18545 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
18546 L_ORG_KEY ORG_KEY_LIST;
18547 L_ORG_EXIST ORG_EXIST_LIST;
18548 L_ORG_PARTY_ID ORG_PARTY_ID_LIST;
18549 L_PARTY_NAME PARTY_NAME_LIST;
18550
18551 cursor c_org_key is
18552 select b2b.party_name, 'N',
18553 hz_fuzzy_pub.Generate_Key('ORGANIZATION',b2b.party_name,null,null,null,null,null,null,null) "org_key"
18554 from ams_hz_b2b_mapping_v b2b
18555 where b2b.import_list_header_id = p_import_list_header_id
18556 and b2b.load_status in ('ACTIVE','RELOAD')
18557 and b2b.party_name is not null
18558 and b2b.org_key is null
18559 and b2b.org_party_id is null
18560 group by b2b.party_name;
18561
18562
18563 cursor c_customer_exists is
18564 select b2b.org_key, 'Y'
18565 from ams_hz_b2b_mapping_v b2b
18566 where b2b.import_list_header_id = 40236
18567 -- and nvl(b2b.org_exist,'N') = 'N'
18568 and b2b.org_key is not null
18569 and b2b.load_status in ('ACTIVE','RELOAD')
18570 and exists (select 1 from hz_parties pty
18571 where pty.customer_key = b2b.org_key
18572 and pty.party_type = 'ORGANIZATION'
18573 and pty.status = 'A')
18574 group by b2b.org_key;
18575
18576
18577 cursor c_address_country is
18578 select b2b.import_source_line_id, max(psite.party_id)
18579 from hz_party_sites psite, hz_locations loc,
18580 hz_parties party, ams_hz_b2b_mapping_v b2b
18581 where b2b.import_list_header_id = p_import_list_header_id
18582 and b2b.load_status in ('ACTIVE','RELOAD')
18583 and b2b.org_exist = 'Y'
18584 and b2b.address1 is not null
18585 and b2b.country is not null
18586 and b2b.org_party_id is null
18587 and loc.address1 = b2b.address1
18588 and loc.country = b2b.country
18589 and party.customer_key = b2b.org_key
18590 and party.party_type = 'ORGANIZATION'
18591 and psite.location_id = loc.location_id
18592 and psite.party_id = party.party_id
18593 and party.status = 'A'
18594 group by b2b.import_source_line_id;
18595
18596 cursor c_country is
18597 select b2b.import_source_line_id, max(psite.party_id)
18598 from hz_party_sites psite, hz_locations loc,
18599 hz_parties party, ams_hz_b2b_mapping_v b2b
18600 where b2b.import_list_header_id = p_import_list_header_id
18601 and b2b.load_status in ('ACTIVE','RELOAD')
18602 and b2b.org_exist = 'Y'
18603 and b2b.country is not null
18604 and b2b.org_party_id is null
18605 and loc.country = b2b.country
18606 and party.customer_key = b2b.org_key
18607 and party.party_type = 'ORGANIZATION'
18608 and psite.location_id = loc.location_id
18609 and psite.party_id = party.party_id
18610 and party.status = 'A'
18611 group by b2b.import_source_line_id;
18612
18613 cursor c_max_party is
18614 select b2b.import_source_line_id, max(pty. party_id)
18615 from hz_parties pty, ams_hz_b2b_mapping_v b2b
18616 where b2b.import_list_header_id = p_import_list_header_id
18617 and b2b.load_status in ('ACTIVE','RELOAD')
18618 and b2b.org_exist = 'Y'
18619 and b2b.org_party_id is null
18620 and customer_key = b2b.org_key
18621 and party_type = 'ORGANIZATION'
18622 and pty.status = 'A'
18623 group by b2b.import_source_line_id;
18624
18625 BEGIN
18626 x_return_status := FND_API.G_RET_STS_SUCCESS;
18627 -- TO POPULATE ORG_KEY
18628 l_last_fetch := FALSE;
18629
18630 open c_org_key;
18631 LOOP
18632 fetch c_org_key BULK COLLECT into
18633 L_PARTY_NAME,
18634 L_ORG_EXIST,
18635 L_ORG_KEY LIMIT l_limit_rows;
18636
18637 IF c_org_key%NOTFOUND THEN
18638 l_last_fetch := TRUE;
18639 END IF;
18640
18641 IF L_PARTY_NAME.COUNT = 0 AND l_last_fetch THEN
18642 EXIT;
18643 END IF;
18644 FORALL i IN L_PARTY_NAME.FIRST..L_PARTY_NAME.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18645 SET org_key = L_ORG_KEY(I),
18646 org_exist = L_ORG_EXIST(I)
18647 WHERE party_name = L_PARTY_NAME(i)
18648 and import_list_header_id = p_import_list_header_id ;
18649
18650 if l_last_fetch then
18651 exit;
18652 end if;
18653 commit;
18654 END LOOP;
18655 close c_org_key;
18656 -- TO POPULATE ORG_KEY
18657
18658 -- TO POPULATE ORG_EXIST
18659 l_last_fetch := FALSE;
18660 L_IMPORT_SOURCE_LINE_ID := null;
18661 L_ORG_EXIST := null;
18662 L_ORG_KEY := null;
18663 open c_customer_exists;
18664 LOOP
18665 fetch c_customer_exists BULK COLLECT into
18666 L_ORG_KEY,
18667 L_ORG_EXIST LIMIT l_limit_rows;
18668
18669 IF c_customer_exists%NOTFOUND THEN
18670 l_last_fetch := TRUE;
18671 END IF;
18672
18673 IF L_ORG_KEY.COUNT = 0 AND l_last_fetch THEN
18674 EXIT;
18675 END IF;
18676 FORALL i IN L_ORG_KEY.FIRST..L_ORG_KEY.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18677 SET org_exist = L_ORG_EXIST(I)
18678 WHERE org_key = L_ORG_KEY(i)
18679 -- and org_key is null
18680 and import_list_header_id = p_import_list_header_id ;
18681
18682 if l_last_fetch then
18683 exit;
18684 end if;
18685 commit;
18686 END LOOP;
18687 close c_customer_exists;
18688 -- TO POPULATE ORG_EXIST
18689
18690
18691 -- TO CHECK WITH ADDRESS AND COUNTRY
18692 l_last_fetch := FALSE;
18693 L_IMPORT_SOURCE_LINE_ID := null;
18694 open c_address_country;
18695 LOOP
18696 fetch c_address_country BULK COLLECT into
18697 L_IMPORT_SOURCE_LINE_ID,
18698 L_ORG_PARTY_ID LIMIT l_limit_rows;
18699
18700 IF c_address_country%NOTFOUND THEN
18701 l_last_fetch := TRUE;
18702 END IF;
18703
18704 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
18705 EXIT;
18706 END IF;
18707 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18708 SET org_party_id = L_ORG_PARTY_ID(I)
18709 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
18710
18711 if l_last_fetch then
18712 exit;
18713 end if;
18714 commit;
18715 END LOOP;
18716 close c_address_country;
18717 -- TO CHECK WITH ADDRESS AND COUNTRY
18718
18719
18720 -- TO CHECK WITH COUNTRY
18721 l_last_fetch := FALSE;
18722 L_IMPORT_SOURCE_LINE_ID := null;
18723 L_ORG_PARTY_ID := null;
18724 open c_country;
18725 LOOP
18726 fetch c_country BULK COLLECT into
18727 L_IMPORT_SOURCE_LINE_ID,
18728 L_ORG_PARTY_ID LIMIT l_limit_rows;
18729
18730 IF c_country%NOTFOUND THEN
18731 l_last_fetch := TRUE;
18732 END IF;
18733
18734 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
18735 EXIT;
18736 END IF;
18737 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18738 SET org_party_id = L_ORG_PARTY_ID(I)
18739 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
18740
18741 if l_last_fetch then
18742 exit;
18743 end if;
18744 commit;
18745 END LOOP;
18746 close c_country;
18747 -- TO CHECK WITH COUNTRY
18748
18749
18750 -- TO GET THE MAX PARTY_ID
18751 l_last_fetch := FALSE;
18752 L_IMPORT_SOURCE_LINE_ID := null;
18753 L_ORG_PARTY_ID := null;
18754 open c_max_party;
18755 LOOP
18756 fetch c_max_party BULK COLLECT into
18757 L_IMPORT_SOURCE_LINE_ID,
18758 L_ORG_PARTY_ID LIMIT l_limit_rows;
18759
18760 IF c_max_party%NOTFOUND THEN
18761 l_last_fetch := TRUE;
18762 END IF;
18763
18764 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
18765 EXIT;
18766 END IF;
18767 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18768 SET org_party_id = L_ORG_PARTY_ID(I)
18769 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
18770
18771 if l_last_fetch then
18772 exit;
18773 end if;
18774 commit;
18775 END LOOP;
18776 close c_max_party;
18777 -- TO GET THE MAX PARTY_ID
18778
18779 EXCEPTION
18780 WHEN OTHERS THEN
18781 x_return_status := FND_API.G_RET_STS_ERROR;
18782 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
18783 FND_MESSAGE.Set_Token('ROW','Error in org_existence_checking :' || SQLERRM||' '||SQLCODE);
18784 AMS_Utility_PVT.Create_Log (
18785 x_return_status => x_return_status,
18786 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
18787 p_log_used_by_id => p_import_list_header_id,
18788 p_msg_data => FND_MESSAGE.get,
18789 p_msg_type => 'DEBUG'
18790 );
18791
18792 end org_existence_checking;
18793
18794
18795 -- --------------------------------------------------------------------------
18796 --
18797 -- This procedure is used for existence checking for import process with osr
18798 --
18799 --
18800 PROCEDURE org_existence_checking_osr(
18801 p_import_list_header_id IN NUMBER,
18802 x_return_status OUT NOCOPY VARCHAR2,
18803 x_msg_count OUT NOCOPY NUMBER,
18804 x_msg_data OUT NOCOPY VARCHAR2
18805 ) IS
18806 l_limit_rows number := 1000;
18807 l_last_fetch BOOLEAN;
18808 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
18809 TYPE ORG_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ORG_KEY%TYPE;
18810 TYPE ORG_EXIST_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ORG_EXIST%TYPE;
18811 TYPE ORG_PARTY_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ORG_PARTY_ID%TYPE;
18812 TYPE PARTY_NAME_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.COL1%TYPE;
18813
18814 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
18815 L_ORG_KEY ORG_KEY_LIST;
18816 L_ORG_EXIST ORG_EXIST_LIST;
18817 L_ORG_PARTY_ID ORG_PARTY_ID_LIST;
18818 L_PARTY_NAME PARTY_NAME_LIST;
18819
18820 cursor c_org_key is
18821 select b2b.party_name, 'N',
18822 hz_fuzzy_pub.Generate_Key('ORGANIZATION',b2b.party_name,null,null,null,null,null,null,null) "org_key"
18823 from ams_hz_b2b_mapping_v b2b
18824 where b2b.import_list_header_id = p_import_list_header_id
18825 and b2b.load_status in ('ACTIVE','RELOAD')
18826 and b2b.party_name is not null
18827 and b2b.org_key is null
18828 and b2b.org_party_id is null
18829
18830 group by b2b.party_name;
18831
18832
18833 cursor c_customer_exists is
18834 select b2b.org_key, 'Y'
18835 from hz_parties pty, ams_hz_b2b_mapping_v b2b
18836 where b2b.import_list_header_id = p_import_list_header_id
18837 and pty.customer_key = b2b.org_key
18838 and b2b.org_key is not null
18839 and b2b.org_party_id is null
18840 and b2b.load_status in ('ACTIVE','RELOAD')
18841 and pty.party_type = 'ORGANIZATION'
18842 and pty.orig_system_reference = b2b.orig_system_reference
18843 and pty.status = 'A'
18844 group by b2b.org_key,b2b.orig_system_reference;
18845
18846
18847 cursor c_address_country is
18848 select b2b.import_source_line_id, max(psite.party_id)
18849 from hz_party_sites psite, hz_locations loc,
18850 hz_parties party, ams_hz_b2b_mapping_v b2b
18851 where b2b.import_list_header_id = p_import_list_header_id
18852 and b2b.load_status in ('ACTIVE','RELOAD')
18853 and b2b.org_exist = 'Y'
18854 and b2b.address1 is not null
18855 and b2b.country is not null
18856 and b2b.org_party_id is null
18857 and loc.address1 = b2b.address1
18858 and loc.country = b2b.country
18859 and party.customer_key = b2b.org_key
18860 and party.party_type = 'ORGANIZATION'
18861 and psite.location_id = loc.location_id
18862 and psite.party_id = party.party_id
18863 and party.orig_system_reference = b2b.orig_system_reference
18864 and party.status = 'A'
18865 group by b2b.import_source_line_id;
18866
18867 cursor c_country is
18868 select b2b.import_source_line_id, max(psite.party_id)
18869 from hz_party_sites psite, hz_locations loc,
18870 hz_parties party, ams_hz_b2b_mapping_v b2b
18871 where b2b.import_list_header_id = p_import_list_header_id
18872 and b2b.load_status in ('ACTIVE','RELOAD')
18873 and b2b.org_exist = 'Y'
18874 and b2b.country is not null
18875 and b2b.org_party_id is null
18876 and loc.country = b2b.country
18877 and party.customer_key = b2b.org_key
18878 and party.party_type = 'ORGANIZATION'
18879 and psite.location_id = loc.location_id
18880 and psite.party_id = party.party_id
18881 and party.orig_system_reference = b2b.orig_system_reference
18882 and party.status = 'A'
18883 group by b2b.import_source_line_id;
18884
18885 cursor c_max_party is
18886 select b2b.import_source_line_id, max(pty. party_id)
18887 from hz_parties pty, ams_hz_b2b_mapping_v b2b
18888 where b2b.import_list_header_id = p_import_list_header_id
18889 and b2b.load_status in ('ACTIVE','RELOAD')
18890 and b2b.org_exist = 'Y'
18891 and b2b.org_party_id is null
18892 and customer_key = b2b.org_key
18893 and party_type = 'ORGANIZATION'
18894 and pty.orig_system_reference = b2b.orig_system_reference
18895 and pty.status = 'A'
18896 group by b2b.import_source_line_id;
18897
18898 BEGIN
18899 x_return_status := FND_API.G_RET_STS_SUCCESS;
18900 -- TO POPULATE ORG_KEY
18901 l_last_fetch := FALSE;
18902 open c_org_key;
18903 LOOP
18904 fetch c_org_key BULK COLLECT into
18905 L_PARTY_NAME,
18906 L_ORG_EXIST,
18907 L_ORG_KEY LIMIT l_limit_rows;
18908
18909 IF c_org_key%NOTFOUND THEN
18910 l_last_fetch := TRUE;
18911 END IF;
18912
18913 IF L_PARTY_NAME.COUNT = 0 AND l_last_fetch THEN
18914 EXIT;
18915 END IF;
18916 FORALL i IN L_PARTY_NAME.FIRST..L_PARTY_NAME.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18917 SET org_key = L_ORG_KEY(I),
18918 org_exist = L_ORG_EXIST(I)
18919 WHERE party_name = L_PARTY_NAME(i)
18920 and import_list_header_id = p_import_list_header_id ;
18921
18922 if l_last_fetch then
18923 exit;
18924 end if;
18925 commit;
18926 END LOOP;
18927 close c_org_key;
18928 -- TO POPULATE ORG_KEY
18929
18930 -- TO POPULATE ORG_EXIST
18931 l_last_fetch := FALSE;
18932 L_IMPORT_SOURCE_LINE_ID := null;
18933 L_ORG_EXIST := null;
18934 L_ORG_KEY := null;
18935 open c_customer_exists;
18936 LOOP
18937 fetch c_customer_exists BULK COLLECT into
18938 L_ORG_KEY,
18939 L_ORG_EXIST LIMIT l_limit_rows;
18940
18941 IF c_customer_exists%NOTFOUND THEN
18942 l_last_fetch := TRUE;
18943 END IF;
18944
18945 IF L_ORG_KEY.COUNT = 0 AND l_last_fetch THEN
18946 EXIT;
18947 END IF;
18948 FORALL i IN L_ORG_KEY.FIRST..L_ORG_KEY.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18949 SET org_exist = L_ORG_EXIST(I)
18950 WHERE org_key = L_ORG_KEY(i)
18951 and org_key is null
18952 and import_list_header_id = p_import_list_header_id ;
18953
18954 if l_last_fetch then
18955 exit;
18956 end if;
18957 commit;
18958 END LOOP;
18959 close c_customer_exists;
18960 -- TO POPULATE ORG_EXIST
18961
18962
18963 -- TO CHECK WITH ADDRESS AND COUNTRY
18964 l_last_fetch := FALSE;
18965 L_IMPORT_SOURCE_LINE_ID := null;
18966 open c_address_country;
18967 LOOP
18968 fetch c_address_country BULK COLLECT into
18969 L_IMPORT_SOURCE_LINE_ID,
18970 L_ORG_PARTY_ID LIMIT l_limit_rows;
18971
18972 IF c_address_country%NOTFOUND THEN
18973 l_last_fetch := TRUE;
18974 END IF;
18975
18976 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
18977 EXIT;
18978 END IF;
18979 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
18980 SET org_party_id = L_ORG_PARTY_ID(I)
18981 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
18982
18983 if l_last_fetch then
18984 exit;
18985 end if;
18986 commit;
18987 END LOOP;
18988 close c_address_country;
18989 -- TO CHECK WITH ADDRESS AND COUNTRY
18990
18991
18992 -- TO CHECK WITH COUNTRY
18993 l_last_fetch := FALSE;
18994 L_IMPORT_SOURCE_LINE_ID := null;
18995 L_ORG_PARTY_ID := null;
18996 open c_country;
18997 LOOP
18998 fetch c_country BULK COLLECT into
18999 L_IMPORT_SOURCE_LINE_ID,
19000 L_ORG_PARTY_ID LIMIT l_limit_rows;
19001
19002 IF c_country%NOTFOUND THEN
19003 l_last_fetch := TRUE;
19004 END IF;
19005
19006 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19007 EXIT;
19008 END IF;
19009 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19010 SET org_party_id = L_ORG_PARTY_ID(I)
19011 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19012
19013 if l_last_fetch then
19014 exit;
19015 end if;
19016 commit;
19017 END LOOP;
19018 close c_country;
19019 -- TO CHECK WITH COUNTRY
19020
19021
19022 -- TO GET THE MAX PARTY_ID
19023 l_last_fetch := FALSE;
19024 L_IMPORT_SOURCE_LINE_ID := null;
19025 L_ORG_PARTY_ID := null;
19026 open c_max_party;
19027 LOOP
19028 fetch c_max_party BULK COLLECT into
19029 L_IMPORT_SOURCE_LINE_ID,
19030 L_ORG_PARTY_ID LIMIT l_limit_rows;
19031
19032 IF c_max_party%NOTFOUND THEN
19033 l_last_fetch := TRUE;
19034 END IF;
19035
19036 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19037 EXIT;
19038 END IF;
19039 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19040 SET org_party_id = L_ORG_PARTY_ID(I)
19041 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19042
19043 if l_last_fetch then
19044 exit;
19045 end if;
19046 commit;
19047 END LOOP;
19048 close c_max_party;
19049 -- TO GET THE MAX PARTY_ID
19050
19051 EXCEPTION
19052 WHEN OTHERS THEN
19053 x_return_status := FND_API.G_RET_STS_ERROR;
19054 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
19055 FND_MESSAGE.Set_Token('ROW','Error in org_existence_checking_osr :' || SQLERRM||' '||SQLCODE);
19056 AMS_Utility_PVT.Create_Log (
19057 x_return_status => x_return_status,
19058 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
19059 p_log_used_by_id => p_import_list_header_id,
19060 p_msg_data => FND_MESSAGE.get,
19061 p_msg_type => 'DEBUG'
19062 );
19063
19064 end org_existence_checking_osr;
19065
19066 -- ------------------------------------------------------
19067 --
19068 -- This procedure is used for existence checking for Person
19069 --
19070 --
19071 PROCEDURE per_existence_checking(
19072 p_import_list_header_id IN NUMBER,
19073 x_return_status OUT NOCOPY VARCHAR2,
19074 x_msg_count OUT NOCOPY NUMBER,
19075 x_msg_data OUT NOCOPY VARCHAR2
19076 ) IS
19077 l_limit_rows number := 1000;
19078 l_last_fetch BOOLEAN;
19079 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
19080 TYPE person_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_KEY%TYPE;
19081 TYPE person_EXIST_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_EXIST%TYPE;
19082 TYPE person_PARTY_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_PARTY_ID%TYPE;
19083
19084 TYPE person_email_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.col1%TYPE;
19085 TYPE person_phone_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.col1%TYPE;
19086 TYPE person_address1_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.col1%TYPE;
19087 TYPE person_country_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.col1%TYPE;
19088 TYPE person_status_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.load_status%TYPE;
19089
19090 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
19091 L_person_KEY person_KEY_LIST;
19092 L_person_EXIST person_EXIST_LIST;
19093 L_person_PARTY_ID person_PARTY_ID_LIST;
19094
19095 L_person_email person_email_LIST;
19096 L_person_phone person_phone_LIST;
19097 L_person_address1 person_address1_LIST;
19098 L_person_country person_country_LIST;
19099 L_person_status person_status_LIST;
19100
19101 cursor c_per_key is
19102 select b2c.import_source_line_id, 'N',
19103 hz_fuzzy_pub.Generate_Key('PERSON',null,null,null,null,null,null,b2c.PERSON_FIRST_NAME,b2c.PERSON_LAST_NAME) "per_key"
19104 from ams_hz_b2c_mapping_v b2c
19105 where b2c.import_list_header_id = p_import_list_header_id
19106 and b2c.load_status in ('ACTIVE','RELOAD')
19107 and b2c.PERSON_FIRST_NAME is not null
19108 and b2c.PERSON_LAST_NAME is not null
19109 and b2c.PERSON_PARTY_ID is null;
19110
19111 cursor c_person_exists is
19112 select distinct b2c.import_source_line_id, 'Y'
19113 from hz_parties pty, ams_hz_b2c_mapping_v b2c
19114 where b2c.import_list_header_id = p_import_list_header_id
19115 and pty.customer_key = b2c.person_key
19116 and b2c.person_key is not null
19117 and b2c.PERSON_PARTY_ID is null
19118 and b2c.load_status in ('ACTIVE','RELOAD')
19119 and pty.status = 'A'
19120 and pty.party_type = 'PERSON';
19121
19122 cursor c_email_address is
19123 select b2c.import_source_line_id, max(p.party_id)
19124 from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19125 where b2c.import_list_header_id = p_import_list_header_id
19126 and b2c.load_status in ('ACTIVE','RELOAD')
19127 and b2c.person_exist = 'Y'
19128 and b2c.email_address is not null
19129 and b2c.PERSON_PARTY_ID is null
19130 and p.customer_key = b2c.person_key
19131 and p.party_type = 'PERSON'
19132 and p.status = 'A'
19133 and cp.owner_table_id = p.party_id
19134 and cp.owner_table_name = 'HZ_PARTIES'
19135 and upper(cp.email_address) = upper(b2c.email_address)
19136 and cp.primary_flag = 'Y'
19137 group by b2c.import_source_line_id;
19138
19139 cursor c_ph_number is
19140 select b2c.import_source_line_id, max(p.party_id)
19141 from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19142 where b2c.import_list_header_id = p_import_list_header_id
19143 and b2c.load_status in ('ACTIVE','RELOAD')
19144 and b2c.person_exist = 'Y'
19145 and b2c.phone_number is not null
19146 and b2c.person_party_id is null
19147 and p.customer_key = b2c.person_key
19148 and p.party_type = 'PERSON'
19149 and p.status = 'A'
19150 and cp.owner_table_id = p.party_id
19151 and cp.owner_table_name = 'HZ_PARTIES'
19152 and cp.primary_flag = 'Y'
19153 and cp.transposed_phone_number = b2c.transposed_phone_number
19154 -- and cp.phone_number = b2c.phone_number
19155 -- and nvl(cp.phone_country_code,nvl(b2c.phone_country_code,'x')) = nvl(b2c.phone_country_code,'x')
19156 -- and nvl(cp.phone_area_code,nvl(b2c.phone_area_code,'x')) = nvl(b2c.phone_area_code,'x')
19157 group by b2c.import_source_line_id;
19158
19159 cursor c_address_country is
19160 select b2c.import_source_line_id, max(psite.party_id)
19161 from hz_party_sites psite, hz_locations loc, hz_parties party, ams_hz_b2c_mapping_v b2c
19162 where b2c.import_list_header_id = p_import_list_header_id
19163 and b2c.load_status in ('ACTIVE','RELOAD')
19164 and b2c.person_exist = 'Y'
19165 and b2c.address1 is not null
19166 and b2c.country is not null
19167 and b2c.person_party_id is null
19168 and psite.location_id = loc.location_id
19169 and loc.address1 = b2c.address1
19170 and loc.country = b2c.country
19171 and party.customer_key = b2c.person_key
19172 and party.party_type = 'PERSON'
19173 and party.status = 'A'
19174 and psite.party_id = party.party_id
19175 group by b2c.import_source_line_id;
19176
19177 cursor c_per_dedup is
19178 select max(import_source_line_id),person_key,email_address,transposed_phone_number,address1,
19179 country, 'DUPLICATE' status
19180 from ams_hz_b2c_mapping_v
19181 where import_list_header_id = p_import_list_header_id
19182 and load_status in ('ACTIVE','RELOAD')
19183 group by person_key,email_address,transposed_phone_number,address1,country;
19184
19185 begin
19186 x_return_status := FND_API.G_RET_STS_SUCCESS;
19187 -- TO POPULATE person_KEY
19188 l_last_fetch := FALSE;
19189
19190 open c_per_key;
19191 LOOP
19192 fetch c_per_key BULK COLLECT into
19193 L_IMPORT_SOURCE_LINE_ID,
19194 L_person_EXIST,
19195 L_person_KEY LIMIT l_limit_rows;
19196
19197 IF c_per_key%NOTFOUND THEN
19198 l_last_fetch := TRUE;
19199 END IF;
19200
19201 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19202 EXIT;
19203 END IF;
19204
19205 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST
19206 UPDATE AMS_HZ_B2C_MAPPING_V
19207 SET person_key = L_person_KEY(I),
19208 person_exist = L_person_EXIST(I)
19209 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19210
19211 if l_last_fetch then
19212 exit;
19213 end if;
19214 commit;
19215 END LOOP;
19216 close c_per_key;
19217 -- TO POPULATE person_KEY
19218
19219 -- TO POPULATE person_EXIST
19220 l_last_fetch := FALSE;
19221 L_IMPORT_SOURCE_LINE_ID := null;
19222 L_person_EXIST := null;
19223 open c_person_exists;
19224 LOOP
19225 fetch c_person_exists BULK COLLECT into
19226 L_IMPORT_SOURCE_LINE_ID,
19227 L_person_EXIST LIMIT l_limit_rows;
19228
19229 IF c_person_exists%NOTFOUND THEN
19230 l_last_fetch := TRUE;
19231 END IF;
19232
19233 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19234 EXIT;
19235 END IF;
19236 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19237 SET person_exist = L_person_EXIST(I)
19238 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19239
19240 if l_last_fetch then
19241 exit;
19242 end if;
19243 commit;
19244 END LOOP;
19245 close c_person_exists;
19246 -- TO POPULATE person_EXIST
19247
19248 -- TO CHECK WITH email_address
19249 l_last_fetch := FALSE;
19250 L_IMPORT_SOURCE_LINE_ID := null;
19251 open c_email_address;
19252 LOOP
19253 fetch c_email_address BULK COLLECT into
19254 L_IMPORT_SOURCE_LINE_ID,
19255 L_person_PARTY_ID LIMIT l_limit_rows;
19256
19257 IF c_email_address%NOTFOUND THEN
19258 l_last_fetch := TRUE;
19259 END IF;
19260
19261 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19262 EXIT;
19263 END IF;
19264 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19265 SET person_party_id = L_person_PARTY_ID(I)
19266 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19267
19268 if l_last_fetch then
19269 exit;
19270 end if;
19271 commit;
19272 END LOOP;
19273 close c_email_address;
19274 -- TO CHECK WITH email_address
19275
19276 -- TO CHECK WITH phone number
19277 l_last_fetch := FALSE;
19278 L_IMPORT_SOURCE_LINE_ID := null;
19279 L_person_PARTY_ID := null;
19280 open c_ph_number;
19281 LOOP
19282 fetch c_ph_number BULK COLLECT into
19283 L_IMPORT_SOURCE_LINE_ID,
19284 L_person_PARTY_ID LIMIT l_limit_rows;
19285
19286 IF c_ph_number%NOTFOUND THEN
19287 l_last_fetch := TRUE;
19288 END IF;
19289
19290 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19291 EXIT;
19292 END IF;
19293 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19294 SET person_party_id = L_person_PARTY_ID(I)
19295 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19296
19297 if l_last_fetch then
19298 exit;
19299 end if;
19300 commit;
19301 END LOOP;
19302 close c_ph_number;
19303 -- TO CHECK WITH phone_number
19304
19305 -- TO CHECK WITH address and country
19306 l_last_fetch := FALSE;
19307 L_IMPORT_SOURCE_LINE_ID := null;
19308 L_person_PARTY_ID := null;
19309 open c_address_country;
19310 LOOP
19311 fetch c_address_country BULK COLLECT into
19312 L_IMPORT_SOURCE_LINE_ID,
19313 L_person_PARTY_ID LIMIT l_limit_rows;
19314
19315 IF c_address_country%NOTFOUND THEN
19316 l_last_fetch := TRUE;
19317 END IF;
19318
19319 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19320 EXIT;
19321 END IF;
19322 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19323 SET person_party_id = L_person_PARTY_ID(I)
19324 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19325
19326 if l_last_fetch then
19327 exit;
19328 end if;
19329 commit;
19330 END LOOP;
19331 close c_address_country;
19332 -- TO CHECK WITH address and country
19333
19334 -- TO CHECK WITH dedup
19335 l_last_fetch := FALSE;
19336 L_IMPORT_SOURCE_LINE_ID := null;
19337 L_person_KEY := null;
19338 L_person_email := null;
19339 L_person_phone := null;
19340 L_person_address1 := null;
19341 L_person_country := null;
19342 L_person_status := null;
19343
19344 open c_per_dedup;
19345 LOOP
19346 fetch c_per_dedup BULK COLLECT into
19347 L_IMPORT_SOURCE_LINE_ID,L_person_KEY,L_person_email,L_person_phone,L_person_address1,
19348 L_person_country, L_person_status LIMIT l_limit_rows;
19349
19350 IF c_per_dedup%NOTFOUND THEN
19351 l_last_fetch := TRUE;
19352 END IF;
19353
19354 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19355 EXIT;
19356 END IF;
19357 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19358 SET load_status = L_person_status(i)
19359 WHERE import_list_header_id = p_import_list_header_id
19360 and IMPORT_SOURCE_LINE_ID < L_IMPORT_SOURCE_LINE_ID(i)
19361 and load_status in ('ACTIVE','RELOAD')
19362 and person_key = L_person_KEY(i)
19363 and email_address = L_person_email(i)
19364 and transposed_phone_number = L_person_phone(i)
19365 and address1 = L_person_address1(i)
19366 and country = L_person_country(i);
19367
19368
19369 if l_last_fetch then
19370 exit;
19371 end if;
19372 commit;
19373 END LOOP;
19374 close c_per_dedup;
19375 -- TO CHECK WITH dedup
19376
19377 EXCEPTION
19378 WHEN OTHERS THEN
19379 x_return_status := FND_API.G_RET_STS_ERROR;
19380 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
19381 FND_MESSAGE.Set_Token('ROW','Error in per_existence_checking :' || SQLERRM||' '||SQLCODE);
19382 AMS_Utility_PVT.Create_Log (
19383 x_return_status => x_return_status,
19384 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
19385 p_log_used_by_id => p_import_list_header_id,
19386 p_msg_data => FND_MESSAGE.get,
19387 p_msg_type => 'DEBUG'
19388 );
19389
19390 end per_existence_checking;
19391
19392
19393 -- ------------------------------------------------------
19394 --
19395 -- This procedure is used for existence checking for Person with osr
19396 --
19397 --
19398 PROCEDURE per_existence_checking_osr(
19399 p_import_list_header_id IN NUMBER,
19400 x_return_status OUT NOCOPY VARCHAR2,
19401 x_msg_count OUT NOCOPY NUMBER,
19402 x_msg_data OUT NOCOPY VARCHAR2
19403 ) IS
19404 l_limit_rows number := 1000;
19405 l_last_fetch BOOLEAN;
19406 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
19407 TYPE person_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_KEY%TYPE;
19408 TYPE person_EXIST_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_EXIST%TYPE;
19409 TYPE person_PARTY_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_PARTY_ID%TYPE;
19410
19411 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
19412 L_person_KEY person_KEY_LIST;
19413 L_person_EXIST person_EXIST_LIST;
19414 L_person_PARTY_ID person_PARTY_ID_LIST;
19415
19416 cursor c_per_key is
19417 select b2c.import_source_line_id, 'N',
19418 hz_fuzzy_pub.Generate_Key('PERSON',null,null,null,null,null,null,b2c.PERSON_FIRST_NAME,b2c.PERSON_LAST_NAME) "per_key"
19419 from ams_hz_b2c_mapping_v b2c
19420 where b2c.import_list_header_id = p_import_list_header_id
19421 and b2c.load_status in ('ACTIVE','RELOAD')
19422 and b2c.PERSON_FIRST_NAME is not null
19423 and b2c.PERSON_LAST_NAME is not null;
19424
19425 cursor c_person_exists is
19426 select b2c.import_source_line_id, 'Y'
19427 from ams_hz_b2c_mapping_v b2c
19428 where b2c.import_list_header_id = p_import_list_header_id
19429 and b2c.person_key is not null
19430 and b2c.PERSON_PARTY_ID is null
19431 and b2c.load_status in ('ACTIVE','RELOAD')
19432 and exists (select 1 from hz_parties pty
19433 where pty.customer_key = b2c.person_key
19434 and pty.status = 'A'
19435 and pty.party_type = 'PERSON');
19436
19437 cursor c_email_address is
19438 select b2c.import_source_line_id, max(p.party_id)
19439 from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19440 where b2c.import_list_header_id = p_import_list_header_id
19441 and b2c.load_status in ('ACTIVE','RELOAD')
19442 and b2c.person_exist = 'Y'
19443 and b2c.orig_system_reference = p.orig_system_reference
19444 and b2c.email_address is not null
19445 and p.customer_key = b2c.person_key
19446 and p.party_type = 'PERSON'
19447 and p.status = 'A'
19448 and cp.owner_table_id = p.party_id
19449 and cp.owner_table_name = 'HZ_PARTIES'
19450 and upper(cp.email_address) = upper(b2c.email_address)
19451 and cp.primary_flag = 'Y'
19452 group by b2c.import_source_line_id;
19453
19454 cursor c_ph_number is
19455 select b2c.import_source_line_id, max(p.party_id)
19456 from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19457 where b2c.import_list_header_id = p_import_list_header_id
19458 and b2c.load_status in ('ACTIVE','RELOAD')
19459 and b2c.person_exist = 'Y'
19460 and b2c.phone_number is not null
19461 and b2c.person_party_id is null
19462 and b2c.orig_system_reference = p.orig_system_reference
19463 and p.customer_key = b2c.person_key
19464 and p.party_type = 'PERSON'
19465 and p.status = 'A'
19466 and cp.owner_table_id = p.party_id
19467 and cp.owner_table_name = 'HZ_PARTIES'
19468 and cp.primary_flag = 'Y'
19469 and cp.transposed_phone_number = b2c.transposed_phone_number
19470 -- and cp.phone_number = b2c.phone_number
19471 -- and nvl(cp.phone_country_code,nvl(b2c.phone_country_code,'x')) = nvl(b2c.phone_country_code,'x')
19472 -- and nvl(cp.phone_area_code,nvl(b2c.phone_area_code,'x')) = nvl(b2c.phone_area_code,'x')
19473 group by b2c.import_source_line_id;
19474
19475 cursor c_address_country is
19476 select b2c.import_source_line_id, max(psite.party_id)
19477 from hz_party_sites psite, hz_locations loc, hz_parties party, ams_hz_b2c_mapping_v b2c
19478 where b2c.import_list_header_id = p_import_list_header_id
19479 and b2c.load_status in ('ACTIVE','RELOAD')
19480 and b2c.person_exist = 'Y'
19481 and b2c.address1 is not null
19482 and b2c.country is not null
19483 and b2c.person_party_id is null
19484 and psite.location_id = loc.location_id
19485 and loc.address1 = b2c.address1
19486 and loc.country = b2c.country
19487 and party.customer_key = b2c.person_key
19488 and party.party_type = 'PERSON'
19489 and party.status = 'A'
19490 and psite.party_id = party.party_id
19491 and b2c.orig_system_reference = party.orig_system_reference
19492 group by b2c.import_source_line_id;
19493
19494 begin
19495 x_return_status := FND_API.G_RET_STS_SUCCESS;
19496 -- TO POPULATE person_KEY
19497 l_last_fetch := FALSE;
19498 open c_per_key;
19499 LOOP
19500 fetch c_per_key BULK COLLECT into
19501 L_IMPORT_SOURCE_LINE_ID,
19502 L_person_EXIST,
19503 L_person_KEY LIMIT l_limit_rows;
19504
19505 IF c_per_key%NOTFOUND THEN
19506 l_last_fetch := TRUE;
19507 END IF;
19508
19509 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19510 EXIT;
19511 END IF;
19512 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19513 SET person_key = L_person_KEY(I),
19514 person_exist = L_person_EXIST(I)
19515 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19516
19517 if l_last_fetch then
19518 exit;
19519 end if;
19520 commit;
19521 END LOOP;
19522 close c_per_key;
19523 -- TO POPULATE person_KEY
19524
19525 -- TO POPULATE person_EXIST
19526 l_last_fetch := FALSE;
19527 L_IMPORT_SOURCE_LINE_ID := null;
19528 L_person_EXIST := null;
19529 open c_person_exists;
19530 LOOP
19531 fetch c_person_exists BULK COLLECT into
19532 L_IMPORT_SOURCE_LINE_ID,
19533 L_person_EXIST LIMIT l_limit_rows;
19534
19535 IF c_person_exists%NOTFOUND THEN
19536 l_last_fetch := TRUE;
19537 END IF;
19538
19539 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19540 EXIT;
19541 END IF;
19542 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19543 SET person_exist = L_person_EXIST(I)
19544 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19545
19546 if l_last_fetch then
19547 exit;
19548 end if;
19549 commit;
19550 END LOOP;
19551 close c_person_exists;
19552 -- TO POPULATE person_EXIST
19553
19554 -- TO CHECK WITH email_address
19555 l_last_fetch := FALSE;
19556 L_IMPORT_SOURCE_LINE_ID := null;
19557 open c_email_address;
19558 LOOP
19559 fetch c_email_address BULK COLLECT into
19560 L_IMPORT_SOURCE_LINE_ID,
19561 L_person_PARTY_ID LIMIT l_limit_rows;
19562
19563 IF c_email_address%NOTFOUND THEN
19564 l_last_fetch := TRUE;
19565 END IF;
19566
19567 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19568 EXIT;
19569 END IF;
19570 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19571 SET person_party_id = L_person_PARTY_ID(I)
19572 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19573
19574 if l_last_fetch then
19575 exit;
19576 end if;
19577 commit;
19578 END LOOP;
19579 close c_email_address;
19580 -- TO CHECK WITH email_address
19581
19582 -- TO CHECK WITH phone number
19583 l_last_fetch := FALSE;
19584 L_IMPORT_SOURCE_LINE_ID := null;
19585 L_person_PARTY_ID := null;
19586 open c_ph_number;
19587 LOOP
19588 fetch c_ph_number BULK COLLECT into
19589 L_IMPORT_SOURCE_LINE_ID,
19590 L_person_PARTY_ID LIMIT l_limit_rows;
19591
19592 IF c_ph_number%NOTFOUND THEN
19593 l_last_fetch := TRUE;
19594 END IF;
19595
19596 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19597 EXIT;
19598 END IF;
19599 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19600 SET person_party_id = L_person_PARTY_ID(I)
19601 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19602
19603 if l_last_fetch then
19604 exit;
19605 end if;
19606 commit;
19607 END LOOP;
19608 close c_ph_number;
19609 -- TO CHECK WITH phone_number
19610
19611 -- TO CHECK WITH address and country
19612 l_last_fetch := FALSE;
19613 L_IMPORT_SOURCE_LINE_ID := null;
19614 L_person_PARTY_ID := null;
19615 open c_address_country;
19616 LOOP
19617 fetch c_address_country BULK COLLECT into
19618 L_IMPORT_SOURCE_LINE_ID,
19619 L_person_PARTY_ID LIMIT l_limit_rows;
19620
19621 IF c_address_country%NOTFOUND THEN
19622 l_last_fetch := TRUE;
19623 END IF;
19624
19625 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19626 EXIT;
19627 END IF;
19628 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19629 SET person_party_id = L_person_PARTY_ID(I)
19630 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19631
19632 if l_last_fetch then
19633 exit;
19634 end if;
19635 commit;
19636 END LOOP;
19637 close c_address_country;
19638 -- TO CHECK WITH address and country
19639 EXCEPTION
19640 WHEN OTHERS THEN
19641 x_return_status := FND_API.G_RET_STS_ERROR;
19642 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
19643 FND_MESSAGE.Set_Token('ROW','Error in per_existence_checking_osr :' || SQLERRM||' '||SQLCODE);
19644 AMS_Utility_PVT.Create_Log (
19645 x_return_status => x_return_status,
19646 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
19647 p_log_used_by_id => p_import_list_header_id,
19648 p_msg_data => FND_MESSAGE.get,
19649 p_msg_type => 'DEBUG'
19650 );
19651
19652 end per_existence_checking_osr;
19653
19654 -- -------------------------------------------------------
19655 --
19656 -- This procedure is used for existence checking for organization contacts
19657 --
19658 --
19659 PROCEDURE org_cont_existence_checking(
19660 p_import_list_header_id IN NUMBER,
19661 x_return_status OUT NOCOPY VARCHAR2,
19662 x_msg_count OUT NOCOPY NUMBER,
19663 x_msg_data OUT NOCOPY VARCHAR2
19664 ) IS
19665 l_limit_rows number := 1000;
19666 l_last_fetch BOOLEAN;
19667 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
19668 TYPE person_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_KEY%TYPE;
19669 TYPE ocont_EXIST_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ocont_EXIST%TYPE;
19670 TYPE ocont_PARTY_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ocont_PARTY_ID%TYPE;
19671 TYPE ocont_org_key_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.org_key%TYPE;
19672 TYPE ocont_person_key_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_key%TYPE;
19673 TYPE ocont_email_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.col1%TYPE;
19674 TYPE ocont_phnumb_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.transposed_phone_number%TYPE;
19675 TYPE ocont_status_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.col1%TYPE;
19676
19677
19678 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
19679 L_person_KEY person_KEY_LIST;
19680 L_ocont_EXIST ocont_EXIST_LIST;
19681 L_ocont_PARTY_ID ocont_PARTY_ID_LIST;
19682
19683 L_ocont_status ocont_status_LIST;
19684
19685
19686 L_ocont_org_key ocont_org_key_LIST;
19687 L_ocont_person_key ocont_person_key_LIST;
19688 L_ocont_email ocont_email_LIST;
19689 L_ocont_phnumb ocont_phnumb_LIST;
19690
19691 cursor c_per_key is
19692 select b2b.import_source_line_id, 'N',
19693 hz_fuzzy_pub.Generate_Key('PERSON',null,null,null,null,null,null,b2b.PERSON_FIRST_NAME,b2b.PERSON_LAST_NAME)
19694 "per_key"
19695 from ams_hz_b2b_mapping_v b2b
19696 where b2b.import_list_header_id = p_import_list_header_id
19697 and b2b.load_status in ('ACTIVE','RELOAD')
19698 and b2b.PERSON_FIRST_NAME is not null
19699 and b2b.PERSON_LAST_NAME is not null
19700 -- and b2b.org_party_id is not null
19701 and b2b.OCONT_PARTY_ID is null;
19702
19703 cursor c_person_exists is
19704 SELECT b2b.import_source_line_id, 'Y'
19705 from ams_hz_b2b_mapping_v b2b
19706 where b2b.import_list_header_id = p_import_list_header_id
19707 and b2b.person_key is not null
19708 and b2b.load_status in ('ACTIVE','RELOAD')
19709 and b2b.OCONT_PARTY_ID is null
19710 and exists
19711 ( select null
19712 from hz_parties pty
19713 where pty.customer_key = b2b.person_key
19714 and pty.party_type = 'PERSON'
19715 and pty.status = 'A' );
19716 /*
19717 select b2b.import_source_line_id, 'Y'
19718 from hz_parties pty, ams_hz_b2b_mapping_v b2b
19719 where b2b.import_list_header_id = p_import_list_header_id
19720 and pty.customer_key = b2b.person_key
19721 and b2b.person_key is not null
19722 and b2b.load_status in ('ACTIVE','RELOAD')
19723 and pty.party_type = 'PERSON'
19724 and pty.status = 'A'
19725 -- and b2b.org_party_id is not null
19726 and b2b.OCONT_PARTY_ID is null;
19727 */
19728 cursor c_cont_email_phone is
19729 select b2b.import_source_line_id, max(per.party_id) from
19730 hz_parties org,
19731 hz_parties per,
19732 hz_relationships rel,
19733 hz_contact_points cpoint,
19734 hz_contact_points cpoint1,
19735 ams_hz_b2b_mapping_v b2b
19736 where b2b.import_list_header_id = p_import_list_header_id
19737 and b2b.load_status in ('ACTIVE','RELOAD')
19738 and b2b.ocont_exist = 'Y'
19739 and b2b.phone_number is not null
19740 and b2b.email_address is not null
19741 and b2b.org_party_id is not null
19742 and b2b.OCONT_PARTY_ID is null
19743 and org.party_id = b2b.org_party_id
19744 and org.party_type = 'ORGANIZATION'
19745 and rel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
19746 and rel.SUBJECT_TYPE = 'PERSON'
19747 and rel.OBJECT_TABLE_NAME = 'HZ_PARTIES'
19748 and rel.RELATIONSHIP_CODE = 'CONTACT_OF'
19749 and rel.OBJECT_ID = org.party_id
19750 and rel.SUBJECT_ID = per.PARTY_ID
19751 and per.customer_key = b2b.person_key
19752 and per.status = 'A'
19753 and org.status = 'A'
19754 and cpoint.owner_table_id = rel.party_id
19755 and cpoint.owner_table_name = 'HZ_PARTIES'
19756 and cpoint.contact_point_type = 'EMAIL'
19757 and upper(cpoint.email_address) = upper(b2b.email_address)
19758 and cpoint.status = 'A'
19759 and cpoint1.owner_table_id = rel.party_id
19760 and cpoint1.owner_table_name = 'HZ_PARTIES'
19761 and cpoint1.contact_point_type = 'PHONE'
19762 and cpoint1.transposed_phone_number = b2b.transposed_phone_number
19763 -- and cpoint1.phone_area_code||'-'||cpoint1.phone_number||'-'||cpoint1.phone_extension =
19764 -- b2b.phone_area_code||'-'||b2b.phone_number||'-'||b2b.phone_extention
19765 and (cpoint1.phone_line_type<>'FAX' or cpoint1.phone_line_type is null)
19766 and cpoint1.status = 'A'
19767 group by b2b.import_source_line_id;
19768
19769 cursor c_cont_email is
19770 select b2b.import_source_line_id,max(per.party_id) from
19771 hz_parties org,
19772 hz_parties per,
19773 hz_relationships rel,
19774 hz_contact_points cpoint,
19775 ams_hz_b2b_mapping_v b2b
19776 where b2b.import_list_header_id = p_import_list_header_id
19777 and b2b.load_status in ('ACTIVE','RELOAD')
19778 and b2b.ocont_exist = 'Y'
19779 and b2b.email_address is not null
19780 and b2b.org_party_id is not null
19781 and b2b.ocont_party_id is null
19782 and b2b.OCONT_PARTY_ID is null
19783 and org.party_id = b2b.org_party_id
19784 and org.party_type = 'ORGANIZATION'
19785 and rel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
19786 and rel.SUBJECT_TYPE = 'PERSON'
19787 and rel.OBJECT_TABLE_NAME = 'HZ_PARTIES'
19788 and rel.RELATIONSHIP_CODE = 'CONTACT_OF'
19789 and rel.OBJECT_ID = org.party_id
19790 and rel.SUBJECT_ID = per.PARTY_ID
19791 and per.customer_key = b2b.person_key
19792 and per.status = 'A'
19793 and org.status = 'A'
19794 and cpoint.owner_table_id = rel.party_id
19795 and cpoint.owner_table_name = 'HZ_PARTIES'
19796 and cpoint.contact_point_type = 'EMAIL'
19797 and upper(cpoint.email_address) = upper(b2b.email_address)
19798 and cpoint.status = 'A'
19799 group by b2b.import_source_line_id;
19800
19801 cursor c_cont_phone is
19802 select b2b.import_source_line_id,max(per.party_id) from
19803 hz_parties org,
19804 hz_parties per,
19805 hz_relationships rel,
19806 hz_contact_points cpoint,
19807 ams_hz_b2b_mapping_v b2b
19808 where b2b.import_list_header_id = p_import_list_header_id
19809 and b2b.load_status in ('ACTIVE','RELOAD')
19810 and b2b.ocont_exist = 'Y'
19811 and b2b.phone_number is not null
19812 and b2b.org_party_id is not null
19813 and b2b.ocont_party_id is null
19814 and b2b.OCONT_PARTY_ID is null
19815 and org.party_id = b2b.org_party_id
19816 and org.party_type = 'ORGANIZATION'
19817 and rel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
19818 and rel.SUBJECT_TYPE = 'PERSON'
19819 and rel.OBJECT_TABLE_NAME = 'HZ_PARTIES'
19820 and rel.RELATIONSHIP_CODE = 'CONTACT_OF'
19821 and rel.OBJECT_ID = org.party_id
19822 and rel.SUBJECT_ID = per.PARTY_ID
19823 and per.customer_key = b2b.person_key
19824 and per.status = 'A'
19825 and org.status = 'A'
19826 and cpoint.owner_table_id = rel.party_id
19827 and cpoint.owner_table_name = 'HZ_PARTIES'
19828 and cpoint.contact_point_type = 'PHONE'
19829 and cpoint.transposed_phone_number = b2b.transposed_phone_number
19830 -- and cpoint.phone_area_code||'-'||cpoint.phone_number||'-'||cpoint.phone_extension =
19831 -- b2b.phone_area_code||'-'||b2b.phone_number||'-'||b2b.phone_extention
19832 and (cpoint.phone_line_type<>'FAX' or cpoint.phone_line_type is null)
19833 and cpoint.status = 'A'
19834 group by b2b.import_source_line_id;
19835
19836 cursor c_cont_dedup is
19837 select max(import_source_line_id), org_key,person_key,email_address,transposed_phone_number ,
19838 'DUPLICATE' status
19839 from ams_hz_b2b_mapping_v
19840 where import_list_header_id = p_import_list_header_id
19841 -- and ocont_party_id is null
19842 and load_status in ('ACTIVE','RELOAD')
19843 group by org_key,person_key,email_address,transposed_phone_number;
19844
19845 begin
19846 x_return_status := FND_API.G_RET_STS_SUCCESS;
19847 -- TO POPULATE person_KEY
19848 l_last_fetch := FALSE;
19849 open c_per_key;
19850 LOOP
19851 fetch c_per_key BULK COLLECT into
19852 L_IMPORT_SOURCE_LINE_ID,
19853 L_ocont_EXIST,
19854 L_person_KEY LIMIT l_limit_rows;
19855
19856 IF c_per_key%NOTFOUND THEN
19857 l_last_fetch := TRUE;
19858 END IF;
19859
19860 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19861 EXIT;
19862 END IF;
19863 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19864 SET person_key = L_person_KEY(I),
19865 ocont_exist = L_ocont_EXIST(I)
19866 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19867
19868 if l_last_fetch then
19869 exit;
19870 end if;
19871 commit;
19872 END LOOP;
19873 close c_per_key;
19874 -- TO POPULATE person_KEY
19875
19876 -- TO POPULATE person_EXIST
19877 l_last_fetch := FALSE;
19878 L_IMPORT_SOURCE_LINE_ID := null;
19879 L_ocont_EXIST := null;
19880 open c_person_exists;
19881 LOOP
19882 fetch c_person_exists BULK COLLECT into
19883 L_IMPORT_SOURCE_LINE_ID,
19884 L_ocont_EXIST LIMIT l_limit_rows;
19885
19886 IF c_person_exists%NOTFOUND THEN
19887 l_last_fetch := TRUE;
19888 END IF;
19889
19890 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19891 EXIT;
19892 END IF;
19893 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19894 SET ocont_exist = L_ocont_EXIST(I)
19895 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19896
19897 if l_last_fetch then
19898 exit;
19899 end if;
19900 commit;
19901 END LOOP;
19902 close c_person_exists;
19903 -- TO POPULATE person_EXIST
19904
19905 -- TO CHECK WITH email_address and phone
19906 l_last_fetch := FALSE;
19907 L_IMPORT_SOURCE_LINE_ID := null;
19908 open c_cont_email_phone;
19909 LOOP
19910 fetch c_cont_email_phone BULK COLLECT into
19911 L_IMPORT_SOURCE_LINE_ID,
19912 L_ocont_PARTY_ID LIMIT l_limit_rows;
19913
19914 IF c_cont_email_phone%NOTFOUND THEN
19915 l_last_fetch := TRUE;
19916 END IF;
19917
19918 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19919 EXIT;
19920 END IF;
19921 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19922 SET ocont_party_id = L_ocont_PARTY_ID(I)
19923 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19924
19925 if l_last_fetch then
19926 exit;
19927 end if;
19928 commit;
19929 END LOOP;
19930 close c_cont_email_phone;
19931 -- TO CHECK WITH email_address and phone
19932
19933 -- TO CHECK WITH email_address
19934 l_last_fetch := FALSE;
19935 L_IMPORT_SOURCE_LINE_ID := null;
19936 L_ocont_PARTY_ID := null;
19937 open c_cont_email;
19938 LOOP
19939 fetch c_cont_email BULK COLLECT into
19940 L_IMPORT_SOURCE_LINE_ID,
19941 L_ocont_PARTY_ID LIMIT l_limit_rows;
19942
19943 IF c_cont_email%NOTFOUND THEN
19944 l_last_fetch := TRUE;
19945 END IF;
19946
19947 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19948 EXIT;
19949 END IF;
19950 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19951 SET ocont_party_id = L_ocont_PARTY_ID(I)
19952 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19953
19954 if l_last_fetch then
19955 exit;
19956 end if;
19957 commit;
19958 END LOOP;
19959 close c_cont_email;
19960 -- TO CHECK WITH email_address
19961
19962 -- TO CHECK WITH phone
19963 l_last_fetch := FALSE;
19964 L_IMPORT_SOURCE_LINE_ID := null;
19965 L_ocont_PARTY_ID := null;
19966 open c_cont_phone;
19967 LOOP
19968 fetch c_cont_phone BULK COLLECT into
19969 L_IMPORT_SOURCE_LINE_ID,
19970 L_ocont_PARTY_ID LIMIT l_limit_rows;
19971
19972 IF c_cont_phone%NOTFOUND THEN
19973 l_last_fetch := TRUE;
19974 END IF;
19975
19976 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19977 EXIT;
19978 END IF;
19979 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
19980 SET ocont_party_id = L_ocont_PARTY_ID(I)
19981 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19982
19983 if l_last_fetch then
19984 exit;
19985 end if;
19986 commit;
19987 END LOOP;
19988 close c_cont_phone;
19989 -- TO CHECK WITH phone
19990
19991 -- TO CHECK WITH dedup
19992 l_last_fetch := FALSE;
19993 L_IMPORT_SOURCE_LINE_ID := null;
19994 L_ocont_org_key := null;
19995 L_ocont_person_key := null;
19996 L_ocont_email := null;
19997 L_ocont_phnumb := null;
19998 L_ocont_status := null;
19999 open c_cont_dedup;
20000 LOOP
20001 fetch c_cont_dedup BULK COLLECT into
20002 L_IMPORT_SOURCE_LINE_ID,L_ocont_org_key,L_ocont_person_key,L_ocont_email,
20003 L_ocont_phnumb,L_ocont_status LIMIT l_limit_rows;
20004
20005 IF c_cont_dedup%NOTFOUND THEN
20006 l_last_fetch := TRUE;
20007 END IF;
20008
20009 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20010 EXIT;
20011 END IF;
20012 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20013 SET load_status = L_ocont_status(i)
20014 WHERE import_list_header_id = p_import_list_header_id
20015 and IMPORT_SOURCE_LINE_ID < L_IMPORT_SOURCE_LINE_ID(i)
20016 and load_status in ('ACTIVE','RELOAD')
20017 and org_key = L_ocont_org_key(i)
20018 and person_key = L_ocont_person_key(i)
20019 and email_address = L_ocont_email(i)
20020 and transposed_phone_number = L_ocont_phnumb(i);
20021
20022 if l_last_fetch then
20023 exit;
20024 end if;
20025 commit;
20026 END LOOP;
20027 close c_cont_dedup;
20028 -- TO CHECK WITH dedup
20029
20030 EXCEPTION
20031 WHEN OTHERS THEN
20032 x_return_status := FND_API.G_RET_STS_ERROR;
20033 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
20034 FND_MESSAGE.Set_Token('ROW','Error in org_cont_existence_checking :' || SQLERRM||' '||SQLCODE);
20035 AMS_Utility_PVT.Create_Log (
20036 x_return_status => x_return_status,
20037 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
20038 p_log_used_by_id => p_import_list_header_id,
20039 p_msg_data => FND_MESSAGE.get,
20040 p_msg_type => 'DEBUG'
20041 );
20042
20043 end org_cont_existence_checking;
20044
20045
20046 -- -------------------------------------------------------
20047 --
20048 -- This procedure is used for existence checking for organization contacts with osr
20049 --
20050 --
20051 PROCEDURE org_cont_existence_chk_osr(
20052 p_import_list_header_id IN NUMBER,
20053 x_return_status OUT NOCOPY VARCHAR2,
20054 x_msg_count OUT NOCOPY NUMBER,
20055 x_msg_data OUT NOCOPY VARCHAR2
20056 ) IS
20057 l_limit_rows number := 1000;
20058 l_last_fetch BOOLEAN;
20059 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
20060 TYPE person_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.person_KEY%TYPE;
20061 TYPE ocont_EXIST_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ocont_EXIST%TYPE;
20062 TYPE ocont_PARTY_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.ocont_PARTY_ID%TYPE;
20063
20064 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
20065 L_person_KEY person_KEY_LIST;
20066 L_ocont_EXIST ocont_EXIST_LIST;
20067 L_ocont_PARTY_ID ocont_PARTY_ID_LIST;
20068
20069 cursor c_per_key is
20070 select b2b.import_source_line_id, 'N',
20071 hz_fuzzy_pub.Generate_Key('PERSON',null,null,null,null,null,null,b2b.PERSON_FIRST_NAME,b2b.PERSON_LAST_NAME)
20072 "per_key"
20073 from ams_hz_b2b_mapping_v b2b
20074 where b2b.import_list_header_id = p_import_list_header_id
20075 and b2b.load_status in ('ACTIVE','RELOAD')
20076 and b2b.PERSON_FIRST_NAME is not null
20077 and b2b.PERSON_LAST_NAME is not null
20078 and b2b.org_party_id is not null;
20079
20080 cursor c_person_exists is
20081 select b2b.import_source_line_id, 'Y'
20082 from hz_parties pty, ams_hz_b2b_mapping_v b2b
20083 where b2b.import_list_header_id = p_import_list_header_id
20084 and pty.customer_key = b2b.person_key
20085 and b2b.person_key is not null
20086 and b2b.load_status in ('ACTIVE','RELOAD')
20087 and pty.party_type = 'PERSON'
20088 and pty.status = 'A'
20089 and pty.orig_system_reference = b2b.orig_system_reference
20090 and b2b.org_party_id is not null;
20091
20092 cursor c_cont_email_phone is
20093 select b2b.import_source_line_id, max(per.party_id) from
20094 hz_parties org,
20095 hz_parties per,
20096 hz_relationships rel,
20097 hz_contact_points cpoint,
20098 hz_contact_points cpoint1,
20099 ams_hz_b2b_mapping_v b2b
20100 where b2b.import_list_header_id = p_import_list_header_id
20101 and b2b.load_status in ('ACTIVE','RELOAD')
20102 and b2b.ocont_exist = 'Y'
20103 and b2b.phone_number is not null
20104 and b2b.email_address is not null
20105 and b2b.org_party_id is not null
20106 and org.party_id = b2b.org_party_id
20107 and org.orig_system_reference = b2b.orig_system_reference
20108 and org.party_type = 'ORGANIZATION'
20109 and rel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
20110 and rel.SUBJECT_TYPE = 'PERSON'
20111 and rel.OBJECT_TABLE_NAME = 'HZ_PARTIES'
20112 and rel.RELATIONSHIP_CODE = 'CONTACT_OF'
20113 and rel.OBJECT_ID = org.party_id
20114 and rel.SUBJECT_ID = per.PARTY_ID
20115 and per.customer_key = b2b.person_key
20116 and per.status = 'A'
20117 and org.status = 'A'
20118 and cpoint.owner_table_id = rel.party_id
20119 and cpoint.owner_table_name = 'HZ_PARTIES'
20120 and cpoint.contact_point_type = 'EMAIL'
20121 and upper(cpoint.email_address) = upper(b2b.email_address)
20122 and cpoint.status = 'A'
20123 and cpoint1.owner_table_id = rel.party_id
20124 and cpoint1.owner_table_name = 'HZ_PARTIES'
20125 and cpoint1.contact_point_type = 'PHONE'
20126 and cpoint1.transposed_phone_number = b2b.transposed_phone_number
20127 -- and cpoint1.phone_area_code||'-'||cpoint1.phone_number||'-'||cpoint1.phone_extension =
20128 -- b2b.phone_area_code||'-'||b2b.phone_number||'-'||b2b.phone_extention
20129 and (cpoint1.phone_line_type<>'FAX' or cpoint1.phone_line_type is null)
20130 and cpoint1.status = 'A'
20131 group by b2b.import_source_line_id;
20132
20133 cursor c_cont_email is
20134 select b2b.import_source_line_id,max(per.party_id) from
20135 hz_parties org,
20136 hz_parties per,
20137 hz_relationships rel,
20138 hz_contact_points cpoint,
20139 ams_hz_b2b_mapping_v b2b
20140 where b2b.import_list_header_id = p_import_list_header_id
20141 and b2b.load_status in ('ACTIVE','RELOAD')
20142 and b2b.ocont_exist = 'Y'
20143 and b2b.email_address is not null
20144 and b2b.org_party_id is not null
20145 and b2b.ocont_party_id is null
20146 and org.party_id = b2b.org_party_id
20147 and org.orig_system_reference = b2b.orig_system_reference
20148 and org.party_type = 'ORGANIZATION'
20149 and rel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
20150 and rel.SUBJECT_TYPE = 'PERSON'
20151 and rel.OBJECT_TABLE_NAME = 'HZ_PARTIES'
20152 and rel.RELATIONSHIP_CODE = 'CONTACT_OF'
20153 and rel.OBJECT_ID = org.party_id
20154 and rel.SUBJECT_ID = per.PARTY_ID
20155 and per.customer_key = b2b.person_key
20156 and per.status = 'A'
20157 and org.status = 'A'
20158 and cpoint.owner_table_id = rel.party_id
20159 and cpoint.owner_table_name = 'HZ_PARTIES'
20160 and cpoint.contact_point_type = 'EMAIL'
20161 and upper(cpoint.email_address) = upper(b2b.email_address)
20162 and cpoint.status = 'A'
20163 group by b2b.import_source_line_id;
20164
20165 cursor c_cont_phone is
20166 select b2b.import_source_line_id,max(per.party_id) from
20167 hz_parties org,
20168 hz_parties per,
20169 hz_relationships rel,
20170 hz_contact_points cpoint,
20171 ams_hz_b2b_mapping_v b2b
20172 where b2b.import_list_header_id = p_import_list_header_id
20173 and b2b.load_status in ('ACTIVE','RELOAD')
20174 and b2b.ocont_exist = 'Y'
20175 and b2b.phone_number is not null
20176 and b2b.org_party_id is not null
20177 and b2b.ocont_party_id is null
20178 and org.party_id = b2b.org_party_id
20179 and org.orig_system_reference = b2b.orig_system_reference
20180 and org.party_type = 'ORGANIZATION'
20181 and rel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
20182 and rel.SUBJECT_TYPE = 'PERSON'
20183 and rel.OBJECT_TABLE_NAME = 'HZ_PARTIES'
20184 and rel.RELATIONSHIP_CODE = 'CONTACT_OF'
20185 and rel.OBJECT_ID = org.party_id
20186 and rel.SUBJECT_ID = per.PARTY_ID
20187 and per.customer_key = b2b.person_key
20188 and per.status = 'A'
20189 and org.status = 'A'
20190 and cpoint.owner_table_id = rel.party_id
20191 and cpoint.owner_table_name = 'HZ_PARTIES'
20192 and cpoint.contact_point_type = 'PHONE'
20193 and cpoint.transposed_phone_number = b2b.transposed_phone_number
20194 -- and cpoint.phone_area_code||'-'||cpoint.phone_number||'-'||cpoint.phone_extension =
20195 -- b2b.phone_area_code||'-'||b2b.phone_number||'-'||b2b.phone_extention
20196 and (cpoint.phone_line_type<>'FAX' or cpoint.phone_line_type is null)
20197 and cpoint.status = 'A'
20198 group by b2b.import_source_line_id;
20199
20200 begin
20201 x_return_status := FND_API.G_RET_STS_SUCCESS;
20202 -- TO POPULATE person_KEY
20203 l_last_fetch := FALSE;
20204 open c_per_key;
20205 LOOP
20206 fetch c_per_key BULK COLLECT into
20207 L_IMPORT_SOURCE_LINE_ID,
20208 L_ocont_EXIST,
20209 L_person_KEY LIMIT l_limit_rows;
20210
20211 IF c_per_key%NOTFOUND THEN
20212 l_last_fetch := TRUE;
20213 END IF;
20214
20215 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20216 EXIT;
20217 END IF;
20218 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20219 SET person_key = L_person_KEY(I),
20220 ocont_exist = L_ocont_EXIST(I)
20221 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20222
20223 if l_last_fetch then
20224 exit;
20225 end if;
20226 commit;
20227 END LOOP;
20228 close c_per_key;
20229 -- TO POPULATE person_KEY
20230
20231 -- TO POPULATE person_EXIST
20232 l_last_fetch := FALSE;
20233 L_IMPORT_SOURCE_LINE_ID := null;
20234 L_ocont_EXIST := null;
20235 open c_person_exists;
20236 LOOP
20237 fetch c_person_exists BULK COLLECT into
20238 L_IMPORT_SOURCE_LINE_ID,
20239 L_ocont_EXIST LIMIT l_limit_rows;
20240
20241 IF c_person_exists%NOTFOUND THEN
20242 l_last_fetch := TRUE;
20243 END IF;
20244
20245 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20246 EXIT;
20247 END IF;
20248 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20249 SET ocont_exist = L_ocont_EXIST(I)
20250 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20251
20252 if l_last_fetch then
20253 exit;
20254 end if;
20255 commit;
20256 END LOOP;
20257 close c_person_exists;
20258 -- TO POPULATE person_EXIST
20259
20260 -- TO CHECK WITH email_address and phone
20261 l_last_fetch := FALSE;
20262 L_IMPORT_SOURCE_LINE_ID := null;
20263 open c_cont_email_phone;
20264 LOOP
20265 fetch c_cont_email_phone BULK COLLECT into
20266 L_IMPORT_SOURCE_LINE_ID,
20267 L_ocont_PARTY_ID LIMIT l_limit_rows;
20268
20269 IF c_cont_email_phone%NOTFOUND THEN
20270 l_last_fetch := TRUE;
20271 END IF;
20272
20273 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20274 EXIT;
20275 END IF;
20276 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20277 SET ocont_party_id = L_ocont_PARTY_ID(I)
20278 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20279
20280 if l_last_fetch then
20281 exit;
20282 end if;
20283 commit;
20284 END LOOP;
20285 close c_cont_email_phone;
20286 -- TO CHECK WITH email_address and phone
20287
20288 -- TO CHECK WITH email_address
20289 l_last_fetch := FALSE;
20290 L_IMPORT_SOURCE_LINE_ID := null;
20291 L_ocont_PARTY_ID := null;
20292 open c_cont_email;
20293 LOOP
20294 fetch c_cont_email BULK COLLECT into
20295 L_IMPORT_SOURCE_LINE_ID,
20296 L_ocont_PARTY_ID LIMIT l_limit_rows;
20297
20298 IF c_cont_email%NOTFOUND THEN
20299 l_last_fetch := TRUE;
20300 END IF;
20301
20302 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20303 EXIT;
20304 END IF;
20305 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20306 SET ocont_party_id = L_ocont_PARTY_ID(I)
20307 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20308
20309 if l_last_fetch then
20310 exit;
20311 end if;
20312 commit;
20313 END LOOP;
20314 close c_cont_email;
20315 -- TO CHECK WITH email_address
20316
20317 -- TO CHECK WITH phone
20318 l_last_fetch := FALSE;
20319 L_IMPORT_SOURCE_LINE_ID := null;
20320 L_ocont_PARTY_ID := null;
20321 open c_cont_phone;
20322 LOOP
20323 fetch c_cont_phone BULK COLLECT into
20324 L_IMPORT_SOURCE_LINE_ID,
20325 L_ocont_PARTY_ID LIMIT l_limit_rows;
20326
20327 IF c_cont_phone%NOTFOUND THEN
20328 l_last_fetch := TRUE;
20329 END IF;
20330
20331 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20332 EXIT;
20333 END IF;
20334 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20335 SET ocont_party_id = L_ocont_PARTY_ID(I)
20336 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20337
20338 if l_last_fetch then
20339 exit;
20340 end if;
20341 commit;
20342 END LOOP;
20343 close c_cont_phone;
20344 -- TO CHECK WITH phone
20345
20346 EXCEPTION
20347 WHEN OTHERS THEN
20348 x_return_status := FND_API.G_RET_STS_ERROR;
20349 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
20350 FND_MESSAGE.Set_Token('ROW','Error in org_cont_existence_chk_osr :' || SQLERRM||' '||SQLCODE);
20351 AMS_Utility_PVT.Create_Log (
20352 x_return_status => x_return_status,
20353 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
20354 p_log_used_by_id => p_import_list_header_id,
20355 p_msg_data => FND_MESSAGE.get,
20356 p_msg_type => 'DEBUG'
20357 );
20358
20359 end org_cont_existence_chk_osr;
20360
20361 -- -------------------------------------------------------------------
20362 -- This procedure is used for existence checking for organization address
20363 --
20364 --
20365 PROCEDURE org_address_existence_checking(
20366 p_import_list_header_id IN NUMBER,
20367 x_return_status OUT NOCOPY VARCHAR2,
20368 x_msg_count OUT NOCOPY NUMBER,
20369 x_msg_data OUT NOCOPY VARCHAR2
20370 ) is
20371 l_limit_rows number := 1000;
20372 l_last_fetch BOOLEAN;
20373 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
20374 TYPE address_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.address_KEY%TYPE;
20375 TYPE PARTY_location_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.PARTY_location_ID%TYPE;
20376
20377 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
20378 L_address_KEY address_KEY_LIST;
20379 L_PARTY_location_ID PARTY_location_ID_LIST;
20380
20381 cursor c_addr_key is
20382 select b2b.import_source_line_id,
20383 hz_fuzzy_pub.Generate_Key('ADDRESS',null,b2b.address1,b2b.address2,b2b.address3,b2b.address4,b2b.postal_code,null,null)
20384 "add_key"
20385 from ams_hz_b2b_mapping_v b2b
20386 where b2b.import_list_header_id = p_import_list_header_id
20387 and b2b.load_status in ('ACTIVE','RELOAD')
20388 and b2b.address1 is not null;
20389
20390 cursor c_addr_ps is
20391 select b2b.import_source_line_id,max(loc.location_id)
20392 from hz_party_sites ps, hz_locations loc,ams_hz_b2b_mapping_v b2b
20393 where b2b.import_list_header_id = p_import_list_header_id
20394 and b2b.load_status in ('ACTIVE','RELOAD')
20395 and b2b.address_key is not null
20396 and b2b.org_party_id is not null
20397 and ps.party_id = b2b.org_party_id
20398 and ps.location_id = loc.location_id
20399 and loc.address_key = b2b.address_key
20400 and loc.country = b2b.country
20401 and nvl(loc.city,nvl(b2b.city,'x')) = nvl(b2b.city,'x')
20402 group by b2b.import_source_line_id;
20403
20404 cursor c_addr is
20405 select b2b.import_source_line_id,max(loc.location_id)
20406 from hz_locations loc,ams_hz_b2b_mapping_v b2b
20407 where b2b.import_list_header_id = p_import_list_header_id
20408 and b2b.load_status in ('ACTIVE','RELOAD')
20409 and b2b.address_key is not null
20410 and b2b.party_location_id is null
20411 and loc.address_key = b2b.address_key
20412 and loc.country = b2b.country
20413 and nvl(loc.city,nvl(b2b.city,'x')) = nvl(b2b.city,'x')
20414 group by b2b.import_source_line_id;
20415
20416 begin
20417 x_return_status := FND_API.G_RET_STS_SUCCESS;
20418 -- TO POPULATE address_KEY
20419 l_last_fetch := FALSE;
20420 open c_addr_key;
20421 LOOP
20422 fetch c_addr_key BULK COLLECT into
20423 L_IMPORT_SOURCE_LINE_ID,
20424 L_address_KEY LIMIT l_limit_rows;
20425
20426 IF c_addr_key%NOTFOUND THEN
20427 l_last_fetch := TRUE;
20428 END IF;
20429
20430 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20431 EXIT;
20432 END IF;
20433 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20434 SET address_key = L_address_KEY(I)
20435 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20436
20437 if l_last_fetch then
20438 exit;
20439 end if;
20440 commit;
20441 END LOOP;
20442 close c_addr_key;
20443 -- TO POPULATE address_KEY
20444
20445 -- TO CHECK WITH address with ps
20446 l_last_fetch := FALSE;
20447 L_IMPORT_SOURCE_LINE_ID := null;
20448 open c_addr_ps;
20449 LOOP
20450 fetch c_addr_ps BULK COLLECT into
20451 L_IMPORT_SOURCE_LINE_ID,
20452 L_PARTY_location_ID LIMIT l_limit_rows;
20453
20454 IF c_addr_ps%NOTFOUND THEN
20455 l_last_fetch := TRUE;
20456 END IF;
20457
20458 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20459 EXIT;
20460 END IF;
20461 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20462 SET party_location_id = L_PARTY_location_ID(I)
20463 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20464
20465 if l_last_fetch then
20466 exit;
20467 end if;
20468 commit;
20469 END LOOP;
20470 close c_addr_ps;
20471 -- TO CHECK WITH address ps
20472
20473 -- TO CHECK WITH address
20474 l_last_fetch := FALSE;
20475 L_IMPORT_SOURCE_LINE_ID := null;
20476 L_PARTY_location_ID := null;
20477 open c_addr;
20478 LOOP
20479 fetch c_addr BULK COLLECT into
20480 L_IMPORT_SOURCE_LINE_ID,
20481 L_PARTY_location_ID LIMIT l_limit_rows;
20482
20483 IF c_addr%NOTFOUND THEN
20484 l_last_fetch := TRUE;
20485 END IF;
20486
20487 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20488 EXIT;
20489 END IF;
20490 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20491 SET party_location_id = L_PARTY_location_ID(I)
20492 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20493
20494 if l_last_fetch then
20495 exit;
20496 end if;
20497 commit;
20498 END LOOP;
20499 close c_addr;
20500 -- TO CHECK WITH address
20501
20502 EXCEPTION
20503 WHEN OTHERS THEN
20504 x_return_status := FND_API.G_RET_STS_ERROR;
20505 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
20506 FND_MESSAGE.Set_Token('ROW','Error in org_address_existence_checking :' || SQLERRM||' '||SQLCODE);
20507 AMS_Utility_PVT.Create_Log (
20508 x_return_status => x_return_status,
20509 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
20510 p_log_used_by_id => p_import_list_header_id,
20511 p_msg_data => FND_MESSAGE.get,
20512 p_msg_type => 'DEBUG'
20513 );
20514
20515 end org_address_existence_checking;
20516
20517
20518
20519 -- -------------------------------------------------------------------
20520 -- This procedure is used for existence checking for organization address
20521 --
20522 --
20523 PROCEDURE org_address1_exist_checking(
20524 p_import_list_header_id IN NUMBER,
20525 x_return_status OUT NOCOPY VARCHAR2,
20526 x_msg_count OUT NOCOPY NUMBER,
20527 x_msg_data OUT NOCOPY VARCHAR2
20528 ) is
20529 l_limit_rows number := 1000;
20530 l_last_fetch BOOLEAN;
20531 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
20532 TYPE address_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.org_address_KEY%TYPE;
20533 TYPE PARTY_location_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.org_location_ID%TYPE;
20534
20535 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
20536 L_org_address_KEY address_KEY_LIST;
20537 L_org_location_ID party_location_ID_LIST;
20538
20539 cursor c_addr_key is
20540 select b2b.import_source_line_id,
20541 hz_fuzzy_pub.Generate_Key('ADDRESS',null,b2b.org_address1,b2b.org_address2,b2b.org_address3,b2b.org_address4,b2b.org_postal_code,null,null)
20542 "add_key"
20543 from ams_hz_b2b_mapping_v b2b
20544 where b2b.import_list_header_id = p_import_list_header_id
20545 and b2b.load_status in ('ACTIVE','RELOAD')
20546 and b2b.org_address1 is not null;
20547
20548 cursor c_addr_ps is
20549 select b2b.import_source_line_id,max(loc.location_id)
20550 from hz_party_sites ps, hz_locations loc,ams_hz_b2b_mapping_v b2b
20551 where b2b.import_list_header_id = p_import_list_header_id
20552 and b2b.load_status in ('ACTIVE','RELOAD')
20553 and b2b.org_address_key is not null
20554 and b2b.org_party_id is not null
20555 and ps.party_id = b2b.org_party_id
20556 and ps.location_id = loc.location_id
20557 and loc.address_key = b2b.org_address_key
20558 and loc.country = b2b.org_country
20559 and nvl(loc.city,nvl(b2b.org_city,'x')) = nvl(b2b.org_city,'x')
20560 group by b2b.import_source_line_id;
20561
20562 cursor c_addr is
20563 select b2b.import_source_line_id,max(loc.location_id)
20564 from hz_locations loc,ams_hz_b2b_mapping_v b2b
20565 where b2b.import_list_header_id = p_import_list_header_id
20566 and b2b.load_status in ('ACTIVE','RELOAD')
20567 and b2b.org_address_key is not null
20568 and b2b.org_location_id is null
20569 and loc.address_key = b2b.org_address_key
20570 and loc.country = b2b.org_country
20571 and nvl(loc.city,nvl(b2b.org_city,'x')) = nvl(b2b.org_city,'x')
20572 group by b2b.import_source_line_id;
20573
20574 begin
20575 x_return_status := FND_API.G_RET_STS_SUCCESS;
20576 -- TO POPULATE address_KEY
20577 l_last_fetch := FALSE;
20578 open c_addr_key;
20579 LOOP
20580 fetch c_addr_key BULK COLLECT into
20581 L_IMPORT_SOURCE_LINE_ID,
20582 L_org_address_KEY LIMIT l_limit_rows;
20583
20584 IF c_addr_key%NOTFOUND THEN
20585 l_last_fetch := TRUE;
20586 END IF;
20587
20588 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20589 EXIT;
20590 END IF;
20591 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20592 SET org_address_key = L_org_address_KEY(I)
20593 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20594
20595 if l_last_fetch then
20596 exit;
20597 end if;
20598 commit;
20599 END LOOP;
20600 close c_addr_key;
20601 -- TO POPULATE address_KEY
20602
20603 -- TO CHECK WITH address with ps
20604 l_last_fetch := FALSE;
20605 L_IMPORT_SOURCE_LINE_ID := null;
20606 open c_addr_ps;
20607 LOOP
20608 fetch c_addr_ps BULK COLLECT into
20609 L_IMPORT_SOURCE_LINE_ID,
20610 L_org_location_ID LIMIT l_limit_rows;
20611
20612 IF c_addr_ps%NOTFOUND THEN
20613 l_last_fetch := TRUE;
20614 END IF;
20615
20616 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20617 EXIT;
20618 END IF;
20619 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20620 SET org_location_id = L_org_location_ID(I)
20621 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20622
20623 if l_last_fetch then
20624 exit;
20625 end if;
20626 commit;
20627 END LOOP;
20628 close c_addr_ps;
20629 -- TO CHECK WITH address ps
20630
20631 -- TO CHECK WITH address
20632 l_last_fetch := FALSE;
20633 L_IMPORT_SOURCE_LINE_ID := null;
20634 L_org_location_ID := null;
20635 open c_addr;
20636 LOOP
20637 fetch c_addr BULK COLLECT into
20638 L_IMPORT_SOURCE_LINE_ID,
20639 L_org_location_ID LIMIT l_limit_rows;
20640
20641 IF c_addr%NOTFOUND THEN
20642 l_last_fetch := TRUE;
20643 END IF;
20644
20645 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20646 EXIT;
20647 END IF;
20648 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2B_MAPPING_V
20649 SET org_location_id = L_org_location_ID(I)
20650 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20651
20652 if l_last_fetch then
20653 exit;
20654 end if;
20655 commit;
20656 END LOOP;
20657 close c_addr;
20658 -- TO CHECK WITH address
20659
20660 EXCEPTION
20661 WHEN OTHERS THEN
20662 x_return_status := FND_API.G_RET_STS_ERROR;
20663 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
20664 FND_MESSAGE.Set_Token('ROW','Error in org_address1_exist_checking :' || SQLERRM||' '||SQLCODE);
20665 AMS_Utility_PVT.Create_Log (
20666 x_return_status => x_return_status,
20667 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
20668 p_log_used_by_id => p_import_list_header_id,
20669 p_msg_data => FND_MESSAGE.get,
20670 p_msg_type => 'DEBUG'
20671 );
20672
20673 end org_address1_exist_checking;
20674
20675 -- -------------------------------------------------------------
20676 --
20677 -- This procedure is used for existence checking for person address
20678 --
20679 --
20680 PROCEDURE per_address_existence_checking(
20681 p_import_list_header_id IN NUMBER,
20682 x_return_status OUT NOCOPY VARCHAR2,
20683 x_msg_count OUT NOCOPY NUMBER,
20684 x_msg_data OUT NOCOPY VARCHAR2
20685 ) IS
20686
20687 l_limit_rows number := 1000;
20688 l_last_fetch BOOLEAN;
20689 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
20690 TYPE address_KEY_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.address_KEY%TYPE;
20691 TYPE PARTY_location_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.PARTY_location_ID%TYPE;
20692
20693 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
20694 L_address_KEY address_KEY_LIST;
20695 L_PARTY_location_ID PARTY_location_ID_LIST;
20696
20697 cursor c_addr_key is
20698 select b2c.import_source_line_id,
20699 hz_fuzzy_pub.Generate_Key('ADDRESS',null,b2c.address1,b2c.address2,b2c.address3,b2c.address4,b2c.postal_code,null,null)
20700 "add_key"
20701 from ams_hz_b2c_mapping_v b2c
20702 where b2c.import_list_header_id = p_import_list_header_id
20703 and b2c.load_status in ('ACTIVE','RELOAD')
20704 and b2c.address1 is not null;
20705
20706 cursor c_addr_ps is
20707 select b2c.import_source_line_id,max(loc.location_id)
20708 from hz_party_sites ps, hz_locations loc,ams_hz_b2c_mapping_v b2c
20709 where b2c.import_list_header_id = p_import_list_header_id
20710 and b2c.load_status in ('ACTIVE','RELOAD')
20711 and b2c.address_key is not null
20712 and b2c.person_party_id is not null
20713 and ps.party_id = b2c.person_party_id
20714 and ps.location_id = loc.location_id
20715 and loc.address_key = b2c.address_key
20716 and loc.country = b2c.country
20717 and nvl(loc.city,nvl(b2c.city,'x')) = nvl(b2c.city,'x')
20718 group by b2c.import_source_line_id;
20719
20720 cursor c_addr is
20721 select b2c.import_source_line_id,max(loc.location_id)
20722 from hz_locations loc,ams_hz_b2c_mapping_v b2c
20723 where b2c.import_list_header_id = p_import_list_header_id
20724 and b2c.load_status in ('ACTIVE','RELOAD')
20725 and b2c.address_key is not null
20726 and b2c.party_location_id is null
20727 and loc.address_key = b2c.address_key
20728 and loc.country = b2c.country
20729 and nvl(loc.city,nvl(b2c.city,'x')) = nvl(b2c.city,'x')
20730 group by b2c.import_source_line_id;
20731
20732 begin
20733 x_return_status := FND_API.G_RET_STS_SUCCESS;
20734 -- TO POPULATE address_KEY
20735 l_last_fetch := FALSE;
20736 open c_addr_key;
20737 LOOP
20738 fetch c_addr_key BULK COLLECT into
20739 L_IMPORT_SOURCE_LINE_ID,
20740 L_address_KEY LIMIT l_limit_rows;
20741
20742 IF c_addr_key%NOTFOUND THEN
20743 l_last_fetch := TRUE;
20744 END IF;
20745
20746 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20747 EXIT;
20748 END IF;
20749 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
20750 SET address_key = L_address_KEY(I)
20751 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20752
20753 if l_last_fetch then
20754 exit;
20755 end if;
20756 commit;
20757 END LOOP;
20758 close c_addr_key;
20759 -- TO POPULATE address_KEY
20760
20761 -- TO CHECK WITH address with ps
20762 l_last_fetch := FALSE;
20763 L_IMPORT_SOURCE_LINE_ID := null;
20764 open c_addr_ps;
20765 LOOP
20766 fetch c_addr_ps BULK COLLECT into
20767 L_IMPORT_SOURCE_LINE_ID,
20768 L_PARTY_location_ID LIMIT l_limit_rows;
20769
20770 IF c_addr_ps%NOTFOUND THEN
20771 l_last_fetch := TRUE;
20772 END IF;
20773
20774 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20775 EXIT;
20776 END IF;
20777 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
20778 SET party_location_id = L_PARTY_location_ID(I)
20779 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20780
20781 if l_last_fetch then
20782 exit;
20783 end if;
20784 commit;
20785 END LOOP;
20786 close c_addr_ps;
20787 -- TO CHECK WITH address ps
20788
20789 -- TO CHECK WITH address
20790 l_last_fetch := FALSE;
20791 L_IMPORT_SOURCE_LINE_ID := null;
20792 L_PARTY_location_ID := null;
20793 open c_addr;
20794 LOOP
20795 fetch c_addr BULK COLLECT into
20796 L_IMPORT_SOURCE_LINE_ID,
20797 L_PARTY_location_ID LIMIT l_limit_rows;
20798
20799 IF c_addr%NOTFOUND THEN
20800 l_last_fetch := TRUE;
20801 END IF;
20802
20803 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20804 EXIT;
20805 END IF;
20806 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
20807 SET party_location_id = L_PARTY_location_ID(I)
20808 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20809
20810 if l_last_fetch then
20811 exit;
20812 end if;
20813 commit;
20814 END LOOP;
20815 close c_addr;
20816 -- TO CHECK WITH address
20817
20818 EXCEPTION
20819 WHEN OTHERS THEN
20820 x_return_status := FND_API.G_RET_STS_ERROR;
20821 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
20822 FND_MESSAGE.Set_Token('ROW','Error in per_address_existence_checking :' || SQLERRM||' '||SQLCODE);
20823 AMS_Utility_PVT.Create_Log (
20824 x_return_status => x_return_status,
20825 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
20826 p_log_used_by_id => p_import_list_header_id,
20827 p_msg_data => FND_MESSAGE.get,
20828 p_msg_type => 'DEBUG'
20829 );
20830
20831 end per_address_existence_checking;
20832
20833 -- ---------------------------------------
20834 --
20835 -- This procedure is used to update the status for b2b/b2c import.
20836 --
20837 --
20838 PROCEDURE update_cust_import_status(
20839 p_import_list_header_id IN NUMBER
20840 ) IS
20841 x_import_list_header_id number;
20842 l_import_type VARCHAR2(30);
20843 l_msg_code NUMBER;
20844 l_msg_buf VARCHAR2(4000);
20845 l_batch_id NUMBER;
20846 l_lookup_code VARCHAR2(30);
20847 l_return_status VARCHAR2(1);
20848 X_RETURN_STATUS VARCHAR2(1);
20849 x_msg_count NUMBER;
20850 x_msg_data VARCHAR2(2000);
20851 i_return_status VARCHAR2(1);
20852 l_dedupe_flag VARCHAR2(1);
20853 l_b2b_flag VARCHAR2(1);
20854 l_validate_file VARCHAR2(1);
20855 i_msg_data VARCHAR2(2000);
20856 i_msg_buf VARCHAR2(4000);
20857 i_msg_code NUMBER;
20858 i_msg_count NUMBER;
20859 l_list_header_id NUMBER;
20860 l_duplicate_records NUMBER;
20861 l_user_status_id NUMBER;
20862
20863 l_lead_status VARCHAR2(30);
20864 i_processed_records NUMBER;
20865 i_failed_records NUMBER;
20866 l_request_id NUMBER;
20867 l_conc_prog_name VARCHAR2(60);
20868 l_finish_status VARCHAR2(30);
20869 l_status_code VARCHAR2(30);
20870
20871 l_error_exist VARCHAR2(1);
20872 l_execute_mode VARCHAR2(1);
20873 l_rec_in_stag_tab VARCHAR2(1);
20874 l_loaded_records NUMBER;
20875 l_failed_records NUMBER;
20876 l_loaded_rows NUMBER;
20877 L_TOTAL_RECORDS NUMBER;
20878 l_gen_list VARCHAR2(1);
20879 l_list_name VARCHAR2(240);
20880 l_OWNER_USER_ID NUMBER;
20881 L_TOTAL_DUP_RECORDS number;
20882 i_file_type VARCHAR2(30);
20883 i_xml_element_id NUMBER;
20884 i_dedupe_flag VARCHAR2(1);
20885
20886 cursor c_import_type is
20887 select
20888 GENERATE_LIST,GENERATED_LIST_NAME,OWNER_USER_ID,dedupe_flag
20889 from ams_imp_list_headers_all
20890 where import_list_header_id = p_import_list_header_id;
20891
20892 cursor c_dup_recs is
20893 select count(*) from ams_imp_source_lines
20894 where import_list_header_id = p_import_list_header_id
20895 and duplicate_flag = 'Y';
20896
20897 cursor c_error_exist is
20898 select 'Y' from ams_list_import_errors
20899 where import_list_header_id = p_import_list_header_id
20900 and error_type = 'E'
20901 and rownum < 2;
20902
20903 cursor c_loaded_records is
20904 select count(*) from ams_imp_source_lines
20905 where import_list_header_id = p_import_list_header_id
20906 and load_status = G_STATUS_SUCCESS;
20907
20908 cursor c_failed_records is
20909 select count(*) from ams_imp_source_lines
20910 where import_list_header_id = p_import_list_header_id
20911 and load_status = G_STATUS_ERROR;
20912
20913 cursor c_total_records is
20914 select count(*) from ams_imp_source_lines
20915 where import_list_header_id = p_import_list_header_id
20916 and load_status = 'ACTIVE';
20917
20918 cursor c_dup_records is
20919 select count(*) from ams_imp_source_lines
20920 where import_list_header_id = p_import_list_header_id
20921 and load_status = G_STATUS_DUPLICATE;
20922
20923 cursor c_file_type is
20924 select file_type from ams_imp_documents
20925 where import_list_header_id = p_import_list_header_id;
20926
20927 cursor c_dup_xml_recs is
20928 select COL68 from ams_imp_source_lines
20929 where load_status = 'DUPLICATE'
20930 AND import_list_header_id = p_import_list_header_id;
20931
20932
20933 begin
20934 open c_import_type;
20935 fetch c_import_type into l_gen_list,l_list_name,l_OWNER_USER_ID,i_dedupe_flag;
20936 close c_import_type;
20937
20938 -- ------------------------------------------------------
20939 -- ------------RAISE POST BUSINESS EVENT START ---------------------
20940
20941 Raise_Business_event(p_import_list_header_id,
20942 'oracle.apps.ams.list.ListImportPostEvent');
20943
20944 -- ------------RAISE POST BUSINESS EVENT END ---------------------
20945 -- ------------------------------------------------------
20946 open c_error_exist;
20947 fetch c_error_exist into l_error_exist;
20948 close c_error_exist;
20949 if l_error_exist = 'Y' then
20950 l_lookup_code := 'ERROR';
20951 l_user_status_id := null;
20952 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
20953 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
20954 system_status_code = 'ERROR' and default_flag = 'Y';
20955
20956 UPDATE ams_imp_list_headers_all
20957 set status_code = l_lookup_code,
20958 user_status_id = l_user_status_id,
20959 status_date = sysdate
20960 where import_list_header_id = p_import_list_header_id;
20961 end if;
20962 if l_error_exist is NULL then
20963 l_lookup_code := 'COMPLETED';
20964 l_user_status_id := null;
20965 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
20966 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
20967 system_status_code = 'COMPLETED' and default_flag = 'Y';
20968
20969 UPDATE ams_imp_list_headers_all
20970 set status_code = l_lookup_code,
20971 user_status_id = l_user_status_id,
20972 status_date = sysdate
20973 where import_list_header_id = p_import_list_header_id;
20974 end if;
20975
20976 -- Delete all the errors from the errors table which are sucessful.
20977 delete from ams_list_import_errors where import_list_header_id
20978 = p_import_list_header_id and import_source_line_id in
20979 (select import_source_line_id from ams_imp_source_lines where
20980 import_list_header_id = p_import_list_header_id and load_status = G_STATUS_SUCCESS);
20981 open c_loaded_records;
20982 fetch c_loaded_records into l_loaded_records;
20983 close c_loaded_records;
20984 open c_failed_records;
20985 fetch c_failed_records into l_failed_records;
20986 close c_failed_records;
20987 open c_dup_records;
20988 fetch c_dup_records into L_TOTAL_DUP_RECORDS;
20989 close c_dup_records;
20990 UPDATE ams_imp_list_headers_all
20991 SET loaded_no_of_rows = l_loaded_records,
20992 number_of_failed_records = l_failed_records,
20993 number_of_duplicate_records = L_TOTAL_DUP_RECORDS,
20994 loaded_date = sysdate
20995 WHERE import_list_header_id = p_import_list_header_id;
20996
20997 open c_file_type;
20998 fetch c_file_type into i_file_type;
20999 close c_file_type;
21000
21001 if i_file_type = 'XML' and i_dedupe_flag = 'Y' then
21002 open c_dup_xml_recs;
21003 LOOP
21004 fetch c_dup_xml_recs into i_xml_element_id;
21005
21006 exit when c_dup_xml_recs%notfound;
21007 AMS_List_Import_PUB.process_element_duplicate (
21008 p_import_list_header_id,
21009 i_xml_element_id);
21010 END LOOP;
21011 close c_dup_xml_recs;
21012 end if;
21013
21014 if l_gen_list = 'Y' then
21015 AMS_Utility_PVT.Create_Log (
21016 x_return_status => l_return_status,
21017 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21018 p_log_used_by_id => p_import_list_header_id,
21019 p_msg_data => 'Starting List Generation for List Import.',
21020 p_msg_type => 'DEBUG'
21021 );
21022 l_loaded_rows := 0;
21023 select LOADED_NO_OF_ROWS into l_loaded_rows from ams_imp_list_headers_all
21024 where import_list_header_id = p_import_list_header_id;
21025
21026 if l_loaded_rows > 0 then
21027 AMS_ListGeneration_PKG.create_import_list
21028 ( 1,
21029 'T',
21030 'T',
21031 FND_API.G_VALID_LEVEL_FULL,
21032 l_owner_user_id,
21033 p_import_list_header_id,
21034 i_return_status,
21035 i_msg_count,
21036 i_msg_data,
21037 l_list_header_id,
21038 l_list_name) ;
21039
21040 If i_return_status <> 'S' then
21041 AMS_Utility_PVT.Create_Log (
21042 x_return_status => l_return_status,
21043 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21044 p_log_used_by_id => p_import_list_header_id,
21045 p_msg_data => 'Error in List Generation --'||i_msg_data,
21046 p_msg_type => 'DEBUG'
21047 );
21048 End if;
21049 end if;
21050 AMS_Utility_PVT.Create_Log (
21051 x_return_status => l_return_status,
21052 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21053 p_log_used_by_id => p_import_list_header_id,
21054 p_msg_data => 'End List Generation for List Import.',
21055 p_msg_type => 'DEBUG'
21056 );
21057 end if; -- p_generate_list
21058
21059 l_total_records := 0;
21060 open c_total_records;
21061 fetch c_total_records into l_total_records;
21062 close c_total_records;
21063 AMS_Utility_PVT.Create_Log (
21064 x_return_status => l_return_status,
21065 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21066 p_log_used_by_id => p_import_list_header_id,
21067 p_msg_data => 'Total Number of records not processed: '||to_char(l_total_records),
21068 p_msg_type => 'DEBUG'
21069 );
21070
21071 end update_cust_import_status;
21072
21073
21074 --
21075 -- This procedure is updates the records with request_id ordered by party_name
21076 --
21077 --
21078 PROCEDURE org_party_update(
21079 p_import_list_header_id IN NUMBER,
21080 p_request_id IN NUMBER,
21081 p_batch_size IN NUMBER,
21082 x_return_status OUT NOCOPY VARCHAR2,
21083 x_msg_count OUT NOCOPY NUMBER,
21084 x_msg_data OUT NOCOPY VARCHAR2
21085 ) IS
21086
21087 l_limit_rows number := 1000;
21088 l_last_fetch BOOLEAN;
21089
21090 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
21091
21092 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
21093
21094 cursor c_ordered_recs is
21095
21096 select ab.import_source_line_id from
21097 (select import_source_line_id from ams_imp_source_lines
21098 where import_list_header_id = p_import_list_header_id
21099 and request_id is null
21100 order by org_key) ab
21101 where rownum <= p_batch_size;
21102 /*
21103 select import_source_line_id from ams_imp_source_lines
21104 where import_list_header_id = p_import_list_header_id
21105 and request_id is null
21106 and rownum <= p_batch_size;
21107
21108
21109 SELECT AB.import_source_line_id
21110 from
21111 ( select import_source_line_id, org_key ,ROW_NUMBER() OVER (order by org_key) as id
21112 from ams_imp_source_lines
21113 where import_list_header_id = p_import_list_header_id
21114 and request_id is null ) AB
21115 where AB.id <= p_batch_size;
21116 */
21117
21118 begin
21119 l_last_fetch := FALSE;
21120 L_IMPORT_SOURCE_LINE_ID := null;
21121 open c_ordered_recs;
21122 LOOP
21123 fetch c_ordered_recs BULK COLLECT into
21124 L_IMPORT_SOURCE_LINE_ID LIMIT l_limit_rows;
21125
21126 IF c_ordered_recs%NOTFOUND THEN
21127 l_last_fetch := TRUE;
21128 END IF;
21129
21130 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
21131 EXIT;
21132 END IF;
21133 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_IMP_SOURCE_LINES
21134 SET request_id = p_request_id
21135 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
21136
21137 if l_last_fetch then
21138 exit;
21139 end if;
21140 commit;
21141 END LOOP;
21142 close c_ordered_recs;
21143 commit;
21144 EXCEPTION
21145 WHEN OTHERS THEN
21146 x_return_status := FND_API.G_RET_STS_ERROR;
21147 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
21148 FND_MESSAGE.Set_Token('ROW','Error in org_party_update:' || SQLERRM||' '||SQLCODE);
21149 AMS_Utility_PVT.Create_Log (
21150 x_return_status => x_return_status,
21151 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21152 p_log_used_by_id => p_import_list_header_id,
21153 p_msg_data => FND_MESSAGE.get,
21154 p_msg_type => 'DEBUG'
21155 );
21156
21157 end org_party_update;
21158
21159 -- ------------------------------------
21160 --
21161 -- This procedure is updates the records with transposed phone number.
21162 --
21163 --
21164 PROCEDURE gen_transposed_phone_number(
21165 p_import_list_header_id IN NUMBER,
21166 x_return_status OUT NOCOPY VARCHAR2,
21167 x_msg_count OUT NOCOPY NUMBER,
21168 x_msg_data OUT NOCOPY VARCHAR2
21169 ) IS
21170
21171 l_limit_rows number := 1000;
21172 l_last_fetch BOOLEAN;
21173 l_imp_type varchar2(30);
21174
21175 TYPE IMPORT_SOURCE_LINE_ID_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.IMPORT_SOURCE_LINE_ID%TYPE;
21176 TYPE TRANSPOSED_PH_NUMBER_LIST IS TABLE OF AMS_IMP_SOURCE_LINES.TRANSPOSED_PHONE_NUMBER%TYPE;
21177
21178 L_IMPORT_SOURCE_LINE_ID IMPORT_SOURCE_LINE_ID_LIST;
21179 L_TRANSPOSED_PHONE_NUMBER TRANSPOSED_PH_NUMBER_LIST;
21180
21181 cursor c_imp_type is
21182 select import_type from ams_imp_list_headers_all
21183 where import_list_header_id = p_import_list_header_id;
21184
21185 cursor c_b2b_ph_no is
21186 select IMPORT_SOURCE_LINE_ID ,
21187 hz_phone_number_pkg.transpose(PHONE_COUNTRY_CODE||PHONE_AREA_CODE||PHONE_NUMBER) "TRANS_PHONE_NUMBER"
21188 from
21189 ams_hz_b2b_mapping_v
21190 where import_list_header_id = p_import_list_header_id
21191 and phone_number is not null
21192 and TRANSPOSED_PHONE_NUMBER is null
21193 and load_status in ('ACTIVE','RELOAD');
21194
21195 cursor c_b2c_ph_no is
21196 select IMPORT_SOURCE_LINE_ID ,
21197 hz_phone_number_pkg.transpose(PHONE_COUNTRY_CODE||PHONE_AREA_CODE||PHONE_NUMBER) "TRANS_PHONE_NUMBER"
21198 from
21199 ams_hz_b2c_mapping_v
21200 where import_list_header_id = p_import_list_header_id
21201 and phone_number is not null
21202 and TRANSPOSED_PHONE_NUMBER is null
21203 and load_status in ('ACTIVE','RELOAD');
21204 begin
21205 l_last_fetch := FALSE;
21206 open c_imp_type;
21207 fetch c_imp_type into l_imp_type;
21208 close c_imp_type;
21209
21210 if l_imp_type = 'B2B' then
21211 open c_b2b_ph_no;
21212 LOOP
21213 fetch c_b2b_ph_no BULK COLLECT into
21214 L_IMPORT_SOURCE_LINE_ID, L_TRANSPOSED_PHONE_NUMBER LIMIT l_limit_rows;
21215
21216 IF c_b2b_ph_no%NOTFOUND THEN
21217 l_last_fetch := TRUE;
21218 END IF;
21219
21220 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
21221 EXIT;
21222 END IF;
21223 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_IMP_SOURCE_LINES
21224 SET TRANSPOSED_PHONE_NUMBER = L_TRANSPOSED_PHONE_NUMBER(i)
21225 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
21226 if l_last_fetch then
21227 exit;
21228 end if;
21229 commit;
21230 END LOOP;
21231 close c_b2b_ph_no;
21232 end if ; -- _b2b_flag = 'Y'
21233 if l_imp_type = 'B2C' then
21234 open c_b2c_ph_no;
21235 LOOP
21236 fetch c_b2c_ph_no BULK COLLECT into
21237 L_IMPORT_SOURCE_LINE_ID, L_TRANSPOSED_PHONE_NUMBER LIMIT l_limit_rows;
21238
21239 IF c_b2c_ph_no%NOTFOUND THEN
21240 l_last_fetch := TRUE;
21241 END IF;
21242
21243 IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
21244 EXIT;
21245 END IF;
21246 FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_IMP_SOURCE_LINES
21247 SET TRANSPOSED_PHONE_NUMBER = L_TRANSPOSED_PHONE_NUMBER(i)
21248 WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
21249 if l_last_fetch then
21250 exit;
21251 end if;
21252 commit;
21253 END LOOP;
21254 close c_b2c_ph_no;
21255 end if ; -- l_b2b_flag = 'N'
21256 commit;
21257 EXCEPTION
21258 WHEN OTHERS THEN
21259 x_return_status := FND_API.G_RET_STS_ERROR;
21260 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
21261 FND_MESSAGE.Set_Token('ROW','Error in gen_transposed_phone_number :' || SQLERRM||' '||SQLCODE);
21262 AMS_Utility_PVT.Create_Log (
21263 x_return_status => x_return_status,
21264 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21265 p_log_used_by_id => p_import_list_header_id,
21266 p_msg_data => FND_MESSAGE.get,
21267 p_msg_type => 'DEBUG'
21268 );
21269
21270 end gen_transposed_phone_number;
21271
21272
21273 --
21274 -- for XML updates the error in the element table
21275 --
21276 PROCEDURE update_xml_error_text (
21277 p_import_list_header_id IN NUMBER,
21278 p_import_type IN varchar2) IS
21279
21280 l_org_imp_xml_element_id number;
21281 l_add_imp_xml_element_id number;
21282 l_ocont_imp_xml_element_id number;
21283 l_cp_imp_xml_element_id number;
21284 l_em_imp_xml_element_id number;
21285 l_per_imp_xml_element_id number;
21286 l_return_status varchar2(1000);
21287
21288 cursor c_b2bxmlrec is
21289 select org_imp_xml_element_id, add_imp_xml_element_id, ocont_imp_xml_element_id,
21290 cp_imp_xml_element_id, em_imp_xml_element_id
21291 from ams_hz_b2b_mapping_v
21292 where import_list_header_id = p_import_list_header_id
21293 and load_status = 'RELOAD';
21294
21295 cursor c_b2cxmlrec is
21296 select per_imp_xml_element_id, add_imp_xml_element_id,cp_imp_xml_element_id, em_imp_xml_element_id
21297 from ams_hz_b2c_mapping_v
21298 where import_list_header_id = p_import_list_header_id
21299 and load_status = 'RELOAD';
21300
21301 begin
21302 if p_import_type = 'B2B' then
21303 open c_b2bxmlrec;
21304 loop
21305 fetch c_b2bxmlrec into l_org_imp_xml_element_id, l_add_imp_xml_element_id,
21306 l_ocont_imp_xml_element_id, l_cp_imp_xml_element_id, l_em_imp_xml_element_id;
21307 exit when c_b2bxmlrec%notfound;
21308 update AMS_IMP_XML_ELEMENTS
21309 set ERROR_TEXT = NULL
21310 where imp_xml_element_id = l_org_imp_xml_element_id;
21311 update AMS_IMP_XML_ELEMENTS
21312 set ERROR_TEXT = NULL
21313 where imp_xml_element_id = l_add_imp_xml_element_id;
21314 update AMS_IMP_XML_ELEMENTS
21315 set ERROR_TEXT = NULL
21316 where imp_xml_element_id = l_ocont_imp_xml_element_id;
21317 update AMS_IMP_XML_ELEMENTS
21318 set ERROR_TEXT = NULL
21319 where imp_xml_element_id = l_cp_imp_xml_element_id;
21320 update AMS_IMP_XML_ELEMENTS
21321 set ERROR_TEXT = NULL
21322 where imp_xml_element_id = l_em_imp_xml_element_id;
21323 end loop;
21324 close c_b2bxmlrec;
21325 end if;
21326
21327
21328 if p_import_type = 'B2C' then
21329 open c_b2cxmlrec;
21330 loop
21331 fetch c_b2cxmlrec into l_per_imp_xml_element_id , l_add_imp_xml_element_id,
21332 l_cp_imp_xml_element_id, l_em_imp_xml_element_id;
21333 exit when c_b2cxmlrec%notfound;
21334 update AMS_IMP_XML_ELEMENTS
21335 set ERROR_TEXT = NULL
21336 where imp_xml_element_id = l_per_imp_xml_element_id;
21337 update AMS_IMP_XML_ELEMENTS
21338 set ERROR_TEXT = NULL
21339 where imp_xml_element_id = l_add_imp_xml_element_id;
21340 update AMS_IMP_XML_ELEMENTS
21341 set ERROR_TEXT = NULL
21342 where imp_xml_element_id = l_cp_imp_xml_element_id;
21343 update AMS_IMP_XML_ELEMENTS
21344 set ERROR_TEXT = NULL
21345 where imp_xml_element_id = l_em_imp_xml_element_id;
21346 end loop;
21347 close c_b2cxmlrec;
21348 end if;
21349
21350 EXCEPTION
21351 WHEN OTHERS THEN
21352 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
21353 FND_MESSAGE.Set_Token('ROW','Error in update_xml_error_text :' || SQLERRM||' '||SQLCODE);
21354 AMS_Utility_PVT.Create_Log (
21355 x_return_status => l_return_status,
21356 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21357 p_log_used_by_id => p_import_list_header_id,
21358 p_msg_data => FND_MESSAGE.get,
21359 p_msg_type => 'DEBUG'
21360 );
21361
21362 end update_xml_error_text;
21363 -- -----------------------------
21364 -- This Program will raise pre business event from list import
21365 PROCEDURE Raise_Business_event(
21366 p_import_list_header_id NUMBER,
21367 p_event VARCHAR2
21368 ) IS
21369
21370 l_parameter_list WF_PARAMETER_LIST_T;
21371 l_new_item_key VARCHAR2(30);
21372 l_return_status VARCHAR2(30);
21373 l_import_type VARCHAR2(30);
21374 l_user_id NUMBER;
21375 l_vendor_id NUMBER;
21376 l_lang_encoding VARCHAR2(30);
21377 l_resp_id NUMBER := FND_GLOBAL.resp_id;
21378 l_error_code VARCHAR2(1);
21379 l_error_text VARCHAR2(4000);
21380 l_user_status_id NUMBER;
21381
21382 Cursor c_header_info is
21383 select import_type,last_updated_by,vendor_id,charset from ams_imp_list_headers_all
21384 where import_list_header_id = p_import_list_header_id;
21385
21386 Begin
21387 AMS_Utility_PVT.Create_Log (
21388 x_return_status => l_return_status,
21389 p_arc_log_used_by => 'IMPH',
21390 p_log_used_by_id => p_import_list_header_id,
21391 p_msg_data => ' Start Business event : '||p_event,
21392 p_msg_type => 'DEBUG'
21393 );
21394 open c_header_info;
21395 fetch c_header_info into l_import_type,l_user_id,l_vendor_id,l_lang_encoding;
21396 close c_header_info;
21397 l_new_item_key := p_import_list_header_id|| TO_CHAR(SYSDATE,'DDMMRRRRHH24MISS');
21398 l_parameter_list := WF_PARAMETER_LIST_T();
21399
21400 wf_event.AddParameterToList(p_name => 'IMPORT_LIST_HEADER_ID',
21401 p_value => p_import_list_header_id,
21402 p_parameterlist => l_parameter_list);
21403
21404 wf_event.AddParameterToList(p_name => 'IMPORT_TYPE',
21405 p_value => l_import_type,
21406 p_parameterlist => l_parameter_list);
21407
21408 wf_event.AddParameterToList(p_name => 'USER_ID',
21409 p_value => l_user_id,
21410 p_parameterlist => l_parameter_list);
21411
21412 wf_event.AddParameterToList(p_name => 'VENDOR_ID',
21413 p_value => l_vendor_id,
21414 p_parameterlist => l_parameter_list);
21415
21416 wf_event.AddParameterToList(p_name => 'LANGUAGE_ENCODING',
21417 p_value => l_lang_encoding,
21418 p_parameterlist => l_parameter_list);
21419
21420 wf_event.AddParameterToList(p_name => 'RESPONSIBILITY_ID',
21421 p_value => l_resp_id,
21422 p_parameterlist => l_parameter_list);
21423 /*
21424 wf_event.AddParameterToList(p_name => 'ERROR_CODE',
21425 p_value => l_error_code,
21426 p_parameterlist => l_parameter_list);
21427
21428 wf_event.AddParameterToList(p_name => 'ERROR_TEXT',
21429 p_value => l_error_text,
21430 p_parameterlist => l_parameter_list);
21431 */
21432 WF_EVENT.Raise
21433 ( p_event_name => p_event,
21434 p_event_key => l_new_item_key,
21435 p_parameters => l_parameter_list);
21436
21437 AMS_Utility_PVT.Create_Log (
21438 x_return_status => l_return_status,
21439 p_arc_log_used_by => 'IMPH',
21440 p_log_used_by_id => p_import_list_header_id,
21441 p_msg_data => 'End Business event : '||p_event,
21442 p_msg_type => 'DEBUG'
21443 );
21444 commit;
21445 /*
21446 if l_error_code = 'E' then
21447 AMS_Utility_PVT.Create_Log (
21448 x_return_status => l_return_status,
21449 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21450 p_log_used_by_id => p_import_list_header_id,
21451 p_msg_data => 'Business Event Error: '||l_error_text,
21452 p_msg_type => 'DEBUG'
21453 );
21454 l_user_status_id := null;
21455 SELECT user_status_id into l_user_status_id FROM ams_user_statuses_vl
21456 WHERE system_status_type = 'AMS_IMPORT_STATUS' AND
21457 system_status_code = 'ERROR' and default_flag = 'Y';
21458 UPDATE ams_imp_list_headers_all
21459 set status_code = 'ERROR' ,
21460 user_status_id = l_user_status_id,
21461 status_date = sysdate
21462 where import_list_header_id = p_import_list_header_id;
21463
21464 return;
21465 end if;
21466 */
21467 EXCEPTION
21468 WHEN OTHERS THEN
21469 FND_MESSAGE.set_name('AMS', 'API_DEBUG_MESSAGE');
21470 FND_MESSAGE.Set_Token('ROW','Error in Raise_Business_event :' ||SQLERRM||' '||SQLCODE);
21471 AMS_Utility_PVT.Create_Log (
21472 x_return_status => l_return_status,
21473 p_arc_log_used_by => G_ARC_IMPORT_HEADER,
21474 p_log_used_by_id => p_import_list_header_id,
21475 p_msg_data => FND_MESSAGE.get,
21476 p_msg_type => 'DEBUG'
21477 );
21478
21479 end Raise_Business_event;
21480
21481 -- -----------------------------
21482 FUNCTION TEST_Pre_sub
21483 ( p_subscription_guid In RAW
21484 , p_event IN OUT NOCOPY WF_EVENT_T
21485 )
21486 RETURN VARCHAR2 IS
21487
21488 l_return_status varchar2(30);
21489 l_import_list_header_id number;
21490 l_import_type varchar2(30);
21491 l_user_id NUMBER;
21492 l_resp_id NUMBER;
21493 l_VENDOR_ID NUMBER;
21494 l_LANGUAGE_ENCODING varchar2(30);
21495
21496
21497 begin
21498 -- SAVEPOINT TEST_Pre_sub;
21499
21500 l_import_list_header_id := p_event.GetValueForParameter('IMPORT_LIST_HEADER_ID');
21501 l_import_type := p_event.GetValueForParameter('IMPORT_TYPE');
21502 l_user_id := p_event.GetValueForParameter('USER_ID');
21503 l_resp_id := p_event.GetValueForParameter('RESPONSIBILITY_ID');
21504 l_VENDOR_ID := p_event.GetValueForParameter('VENDOR_ID');
21505 l_LANGUAGE_ENCODING := p_event.GetValueForParameter('LANGUAGE_ENCODING');
21506 AMS_Utility_PVT.Create_Log (
21507 x_return_status => l_return_status,
21508 p_arc_log_used_by => 'IMPH',
21509 p_log_used_by_id => l_import_list_header_id,
21510 p_msg_data => 'COMING INSIDE TEST_Pre_sub EVENT.......',
21511 p_msg_type => 'DEBUG'
21512 );
21513
21514 AMS_Utility_PVT.Create_Log (
21515 x_return_status => l_return_status,
21516 p_arc_log_used_by => 'IMPH',
21517 p_log_used_by_id => l_import_list_header_id,
21518 p_msg_data => 'IMPORT_LIST_HEADER_ID = '||to_char(l_import_list_header_id),
21519 p_msg_type => 'DEBUG');
21520
21521 AMS_Utility_PVT.Create_Log (
21522 x_return_status => l_return_status,
21523 p_arc_log_used_by => 'IMPH',
21524 p_log_used_by_id => l_import_list_header_id,
21525 p_msg_data => 'IMPORT_TYPE = '||l_import_type,
21526 p_msg_type => 'DEBUG');
21527
21528 AMS_Utility_PVT.Create_Log (
21529 x_return_status => l_return_status,
21530 p_arc_log_used_by => 'IMPH',
21531 p_log_used_by_id => l_import_list_header_id,
21532 p_msg_data => 'USER_ID = '||to_char(l_user_id),
21533 p_msg_type => 'DEBUG');
21534
21535 AMS_Utility_PVT.Create_Log (
21536 x_return_status => l_return_status,
21537 p_arc_log_used_by => 'IMPH',
21538 p_log_used_by_id => l_import_list_header_id,
21539 p_msg_data => 'RESPONSIBILITY_ID = '||to_char(l_resp_id),
21540 p_msg_type => 'DEBUG');
21541
21542 AMS_Utility_PVT.Create_Log (
21543 x_return_status => l_return_status,
21544 p_arc_log_used_by => 'IMPH',
21545 p_log_used_by_id => l_import_list_header_id,
21546 p_msg_data => 'VENDOR_ID = '||to_char(l_VENDOR_ID),
21547 p_msg_type => 'DEBUG');
21548
21549 AMS_Utility_PVT.Create_Log (
21550 x_return_status => l_return_status,
21551 p_arc_log_used_by => 'IMPH',
21552 p_log_used_by_id => l_import_list_header_id,
21553 p_msg_data => 'LANGUAGE_ENCODING = '||l_LANGUAGE_ENCODING,
21554 p_msg_type => 'DEBUG');
21555
21556 update ams_hz_b2b_mapping_v
21557 set CUSTOM_PROCESSING_STATUS = 'pre-processing'
21558 where import_list_header_id = l_import_list_header_id;
21559
21560 return 'SUCCESS';
21561 EXCEPTION
21562 WHEN OTHERS THEN
21563 -- ROLLBACK TO TEST_Pre_sub;
21564 /*
21565 FND_MESSAGE.SET_NAME( 'AMS', 'API_DEBUG_MESSAGE' );
21566 FND_MESSAGE.SET_TOKEN( 'GENERIC_TEXT' ,SQLERRM );
21567 FND_MSG_PUB.ADD;
21568 */
21569 WF_CORE.CONTEXT('AMS_LIST_IMPORT_PUB', 'TEST_Pre_sub', p_event.getEventName(), p_subscription_guid);
21570 WF_EVENT.setErrorInfo(p_event, 'ERROR');
21571
21572 RETURN 'ERROR';
21573
21574 end TEST_Pre_sub;
21575
21576 -- -----------------------------
21577 FUNCTION TEST_Post_sub
21578 ( p_subscription_guid In RAW
21579 , p_event IN OUT NOCOPY WF_EVENT_T
21580 )
21581 RETURN VARCHAR2 IS
21582
21583 l_return_status varchar2(30);
21584 l_import_list_header_id number;
21585 l_import_type varchar2(30);
21586 l_user_id NUMBER;
21587 l_resp_id NUMBER;
21588 l_VENDOR_ID NUMBER;
21589 l_LANGUAGE_ENCODING varchar2(30);
21590
21591
21592 begin
21593 -- SAVEPOINT TEST_Post_sub;
21594
21595 l_import_list_header_id := p_event.GetValueForParameter('IMPORT_LIST_HEADER_ID');
21596 l_import_type := p_event.GetValueForParameter('IMPORT_TYPE');
21597 l_user_id := p_event.GetValueForParameter('USER_ID');
21598 l_resp_id := p_event.GetValueForParameter('RESPONSIBILITY_ID');
21599 l_VENDOR_ID := p_event.GetValueForParameter('VENDOR_ID');
21600 l_LANGUAGE_ENCODING := p_event.GetValueForParameter('LANGUAGE_ENCODING');
21601 AMS_Utility_PVT.Create_Log (
21602 x_return_status => l_return_status,
21603 p_arc_log_used_by => 'IMPH',
21604 p_log_used_by_id => l_import_list_header_id,
21605 p_msg_data => 'COMING INSIDE TEST_Post_sub EVENT.......',
21606 p_msg_type => 'DEBUG'
21607 );
21608 AMS_Utility_PVT.Create_Log (
21609 x_return_status => l_return_status,
21610 p_arc_log_used_by => 'IMPH',
21611 p_log_used_by_id => l_import_list_header_id,
21612 p_msg_data => 'IMPORT_LIST_HEADER_ID = '||to_char(l_import_list_header_id),
21613 p_msg_type => 'DEBUG');
21614
21615 AMS_Utility_PVT.Create_Log (
21616 x_return_status => l_return_status,
21617 p_arc_log_used_by => 'IMPH',
21618 p_log_used_by_id => l_import_list_header_id,
21619 p_msg_data => 'IMPORT_TYPE = '||l_import_type,
21620 p_msg_type => 'DEBUG');
21621
21622 AMS_Utility_PVT.Create_Log (
21623 x_return_status => l_return_status,
21624 p_arc_log_used_by => 'IMPH',
21625 p_log_used_by_id => l_import_list_header_id,
21626 p_msg_data => 'USER_ID = '||to_char(l_user_id),
21627 p_msg_type => 'DEBUG');
21628
21629 AMS_Utility_PVT.Create_Log (
21630 x_return_status => l_return_status,
21631 p_arc_log_used_by => 'IMPH',
21632 p_log_used_by_id => l_import_list_header_id,
21633 p_msg_data => 'RESPONSIBILITY_ID = '||to_char(l_resp_id),
21634 p_msg_type => 'DEBUG');
21635
21636 AMS_Utility_PVT.Create_Log (
21637 x_return_status => l_return_status,
21638 p_arc_log_used_by => 'IMPH',
21639 p_log_used_by_id => l_import_list_header_id,
21640 p_msg_data => 'VENDOR_ID = '||to_char(l_VENDOR_ID),
21641 p_msg_type => 'DEBUG');
21642
21643 AMS_Utility_PVT.Create_Log (
21644 x_return_status => l_return_status,
21645 p_arc_log_used_by => 'IMPH',
21646 p_log_used_by_id => l_import_list_header_id,
21647 p_msg_data => 'LANGUAGE_ENCODING = '||l_LANGUAGE_ENCODING,
21648 p_msg_type => 'DEBUG');
21649 /*
21650 update ams_hz_b2b_mapping_v
21651 set CUSTOM_PROCESSING_STATUS = 'pre-processing'
21652 where import_list_header_id = l_import_list_header_id;
21653 */
21654 return 'SUCCESS';
21655 EXCEPTION
21656 WHEN OTHERS THEN
21657 -- ROLLBACK TO TEST_Post_sub;
21658 /*
21659 FND_MESSAGE.SET_NAME( 'AMS', 'API_DEBUG_MESSAGE' );
21660 FND_MESSAGE.SET_TOKEN( 'GENERIC_TEXT' ,SQLERRM );
21661 FND_MSG_PUB.ADD;
21662 */
21663 WF_CORE.CONTEXT('AMS_LIST_IMPORT_PUB', 'TEST_Post_sub', p_event.getEventName(), p_subscription_guid);
21664 WF_EVENT.setErrorInfo(p_event, 'ERROR');
21665
21666 RETURN 'ERROR';
21667
21668 end TEST_Post_sub;
21669
21670 end AMS_ListImport_PVT;