[Home] [Help]
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:
2682:
2683: elsif l_imp_type = 'B2C' then
2684:
2685: --aanjaria: bug 4913239: copy party_id to person_party_id so that existence check is by passed
2686: UPDATE ams_hz_b2c_mapping_v
2687: SET person_party_id = party_id,
2688: person_exist = 'Y'
2689: WHERE import_list_header_id = p_import_list_header_id
2690: AND party_id is not null
4854: ADDRESS_ATTRIBUTE_CATEGORY ,
4855: SHORT_DESCRIPTION,
4856: DESCRIPTION,
4857: PARTY_SITE_USE
4858: FROM AMS_HZ_B2C_MAPPING_V
4859: WHERE party_id = p_party_id
4860: and load_status = 'SUCCESS';
4861:
4862:
7734: from ams_hz_b2b_mapping_v where import_source_line_id = p_import_source_line_id;
7735:
7736: cursor c_b2cxmlrec is
7737: select per_imp_xml_element_id, add_imp_xml_element_id,cp_imp_xml_element_id, em_imp_xml_element_id
7738: from ams_hz_b2c_mapping_v where import_source_line_id = p_import_source_line_id;
7739:
7740: cursor c_file_type is
7741: select file_type from AMS_IMP_DOCUMENTS where import_list_header_id = p_import_list_header_id;
7742:
9737: Null col145,
9738: Null col146,
9739: Null col147,
9740: Null col148
9741: FROM AMS_HZ_B2C_MAPPING_V
9742: WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
9743: and load_status in ('ACTIVE','RELOAD')
9744: AND
9745: (
10035: DATE_OF_BIRTH,
10036: DATE_OF_DEATH,
10037: null date1,
10038: MARITAL_STATUS_EFFECTIVE_DATE
10039: FROM ams_hz_b2c_mapping_v
10040: WHERE import_list_header_id = p_import_list_header_id
10041: and load_status in ('ACTIVE','RELOAD')
10042: AND (ADDRESS_EFFECTIVE_DATE is not null or ADDRESS_EXPIRATION_DATE is not null or
10043: DATE_OF_BIRTH is not null or DATE_OF_DEATH is not null or MARITAL_STATUS_EFFECTIVE_DATE is not null);
11777: DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(ORIG_SYSTEM_REFERENCE)),'x')),240) -240,0,' ','ORIG_SYSTEM_REFERENCE :'||l_invalid_size
11778: ||'(240)') ORIG_SYSTEM_REFERENCE,
11779: DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(TAX_REFERENCE)),'x')),60) - 60,0,' ','TAX_REFERENCE :'||l_invalid_size||'(60)') TAX_REFERENCE,
11780: DECODE(GREATEST(lengthb(nvl(LTRIM(RTRIM(RENT_OWNED_INDICATOR)),'x')),30) - 30,0,' ','RENT_OWNED_INDICATOR :'||l_invalid_size||'(30)') RENT_OWNED_INDICATOR
11781: FROM AMS_HZ_B2C_MAPPING_V
11782: WHERE IMPORT_LIST_HEADER_ID = p_import_list_header_id
11783: and load_status = 'ERROR'
11784: AND
11785: (
13976: elsif l_import_type = 'B2C' then
13977:
13978: --aanjaria: bug 4913239: copy party_id to person_party_id so that existence check is by passed
13979: -- mayjain bug 5100612 this update should be done only if the party_id is a valid one.
13980: UPDATE ams_hz_b2c_mapping_v b2c
13981: 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,
13982: WHERE import_list_header_id = p_import_list_header_id
13983: AND party_id is not null
13984: AND person_party_id is null;
13983: AND party_id is not null
13984: AND person_party_id is null;
13985:
13986: -- bug 5100612
13987: UPDATE ams_hz_b2c_mapping_v b2c
13988: SET person_exist = 'Y'
13989: WHERE import_list_header_id = p_import_list_header_id
13990: and person_party_id is not null;
13991: end if;
18052: open c_batchID;
18053: fetch c_batchID into l_batch_id;
18054: close c_batchID;
18055: FOR i IN 1..p_cust_b2c_tbl.COUNT LOOP
18056: Insert into AMS_HZ_B2C_MAPPING_V(
18057: IMPORT_SOURCE_LINE_ID,
18058: LAST_UPDATED_BY,
18059: LAST_UPDATE_DATE,
18060: CREATION_DATE,
19101:
19102: cursor c_per_key is
19103: select b2c.import_source_line_id, 'N',
19104: hz_fuzzy_pub.Generate_Key('PERSON',null,null,null,null,null,null,b2c.PERSON_FIRST_NAME,b2c.PERSON_LAST_NAME) "per_key"
19105: from ams_hz_b2c_mapping_v b2c
19106: where b2c.import_list_header_id = p_import_list_header_id
19107: and b2c.load_status in ('ACTIVE','RELOAD')
19108: and b2c.PERSON_FIRST_NAME is not null
19109: and b2c.PERSON_LAST_NAME is not null
19110: and b2c.PERSON_PARTY_ID is null;
19111:
19112: cursor c_person_exists is
19113: select distinct b2c.import_source_line_id, 'Y'
19114: from hz_parties pty, ams_hz_b2c_mapping_v b2c
19115: where b2c.import_list_header_id = p_import_list_header_id
19116: and pty.customer_key = b2c.person_key
19117: and b2c.person_key is not null
19118: and b2c.PERSON_PARTY_ID is null
19121: and pty.party_type = 'PERSON';
19122:
19123: cursor c_email_address is
19124: select b2c.import_source_line_id, max(p.party_id)
19125: from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19126: where b2c.import_list_header_id = p_import_list_header_id
19127: and b2c.load_status in ('ACTIVE','RELOAD')
19128: and b2c.person_exist = 'Y'
19129: and b2c.email_address is not null
19138: group by b2c.import_source_line_id;
19139:
19140: cursor c_ph_number is
19141: select b2c.import_source_line_id, max(p.party_id)
19142: from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19143: where b2c.import_list_header_id = p_import_list_header_id
19144: and b2c.load_status in ('ACTIVE','RELOAD')
19145: and b2c.person_exist = 'Y'
19146: and b2c.phone_number is not null
19158: group by b2c.import_source_line_id;
19159:
19160: cursor c_address_country is
19161: select b2c.import_source_line_id, max(psite.party_id)
19162: from hz_party_sites psite, hz_locations loc, hz_parties party, ams_hz_b2c_mapping_v b2c
19163: where b2c.import_list_header_id = p_import_list_header_id
19164: and b2c.load_status in ('ACTIVE','RELOAD')
19165: and b2c.person_exist = 'Y'
19166: and b2c.address1 is not null
19177:
19178: cursor c_per_dedup is
19179: select max(import_source_line_id),person_key,email_address,transposed_phone_number,address1,
19180: country, 'DUPLICATE' status
19181: from ams_hz_b2c_mapping_v
19182: where import_list_header_id = p_import_list_header_id
19183: and load_status in ('ACTIVE','RELOAD')
19184: group by person_key,email_address,transposed_phone_number,address1,country;
19185:
19203: EXIT;
19204: END IF;
19205:
19206: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST
19207: UPDATE AMS_HZ_B2C_MAPPING_V
19208: SET person_key = L_person_KEY(I),
19209: person_exist = L_person_EXIST(I)
19210: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19211:
19233:
19234: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19235: EXIT;
19236: END IF;
19237: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19238: SET person_exist = L_person_EXIST(I)
19239: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19240:
19241: if l_last_fetch then
19261:
19262: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19263: EXIT;
19264: END IF;
19265: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19266: SET person_party_id = L_person_PARTY_ID(I)
19267: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19268:
19269: if l_last_fetch then
19290:
19291: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19292: EXIT;
19293: END IF;
19294: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19295: SET person_party_id = L_person_PARTY_ID(I)
19296: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19297:
19298: if l_last_fetch then
19319:
19320: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19321: EXIT;
19322: END IF;
19323: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19324: SET person_party_id = L_person_PARTY_ID(I)
19325: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19326:
19327: if l_last_fetch then
19354:
19355: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19356: EXIT;
19357: END IF;
19358: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19359: SET load_status = L_person_status(i)
19360: WHERE import_list_header_id = p_import_list_header_id
19361: and IMPORT_SOURCE_LINE_ID < L_IMPORT_SOURCE_LINE_ID(i)
19362: and load_status in ('ACTIVE','RELOAD')
19416:
19417: cursor c_per_key is
19418: select b2c.import_source_line_id, 'N',
19419: hz_fuzzy_pub.Generate_Key('PERSON',null,null,null,null,null,null,b2c.PERSON_FIRST_NAME,b2c.PERSON_LAST_NAME) "per_key"
19420: from ams_hz_b2c_mapping_v b2c
19421: where b2c.import_list_header_id = p_import_list_header_id
19422: and b2c.load_status in ('ACTIVE','RELOAD')
19423: and b2c.PERSON_FIRST_NAME is not null
19424: and b2c.PERSON_LAST_NAME is not null;
19424: and b2c.PERSON_LAST_NAME is not null;
19425:
19426: cursor c_person_exists is
19427: select b2c.import_source_line_id, 'Y'
19428: from ams_hz_b2c_mapping_v b2c
19429: where b2c.import_list_header_id = p_import_list_header_id
19430: and b2c.person_key is not null
19431: and b2c.PERSON_PARTY_ID is null
19432: and b2c.load_status in ('ACTIVE','RELOAD')
19436: and pty.party_type = 'PERSON');
19437:
19438: cursor c_email_address is
19439: select b2c.import_source_line_id, max(p.party_id)
19440: from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19441: where b2c.import_list_header_id = p_import_list_header_id
19442: and b2c.load_status in ('ACTIVE','RELOAD')
19443: and b2c.person_exist = 'Y'
19444: and b2c.orig_system_reference = p.orig_system_reference
19453: group by b2c.import_source_line_id;
19454:
19455: cursor c_ph_number is
19456: select b2c.import_source_line_id, max(p.party_id)
19457: from hz_contact_points cp, hz_parties p, ams_hz_b2c_mapping_v b2c
19458: where b2c.import_list_header_id = p_import_list_header_id
19459: and b2c.load_status in ('ACTIVE','RELOAD')
19460: and b2c.person_exist = 'Y'
19461: and b2c.phone_number is not null
19474: group by b2c.import_source_line_id;
19475:
19476: cursor c_address_country is
19477: select b2c.import_source_line_id, max(psite.party_id)
19478: from hz_party_sites psite, hz_locations loc, hz_parties party, ams_hz_b2c_mapping_v b2c
19479: where b2c.import_list_header_id = p_import_list_header_id
19480: and b2c.load_status in ('ACTIVE','RELOAD')
19481: and b2c.person_exist = 'Y'
19482: and b2c.address1 is not null
19509:
19510: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19511: EXIT;
19512: END IF;
19513: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19514: SET person_key = L_person_KEY(I),
19515: person_exist = L_person_EXIST(I)
19516: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19517:
19539:
19540: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19541: EXIT;
19542: END IF;
19543: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19544: SET person_exist = L_person_EXIST(I)
19545: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19546:
19547: if l_last_fetch then
19567:
19568: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19569: EXIT;
19570: END IF;
19571: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19572: SET person_party_id = L_person_PARTY_ID(I)
19573: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19574:
19575: if l_last_fetch then
19596:
19597: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19598: EXIT;
19599: END IF;
19600: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19601: SET person_party_id = L_person_PARTY_ID(I)
19602: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19603:
19604: if l_last_fetch then
19625:
19626: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
19627: EXIT;
19628: END IF;
19629: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
19630: SET person_party_id = L_person_PARTY_ID(I)
19631: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
19632:
19633: if l_last_fetch then
20698: cursor c_addr_key is
20699: select b2c.import_source_line_id,
20700: hz_fuzzy_pub.Generate_Key('ADDRESS',null,b2c.address1,b2c.address2,b2c.address3,b2c.address4,b2c.postal_code,null,null)
20701: "add_key"
20702: from ams_hz_b2c_mapping_v b2c
20703: where b2c.import_list_header_id = p_import_list_header_id
20704: and b2c.load_status in ('ACTIVE','RELOAD')
20705: and b2c.address1 is not null;
20706:
20705: and b2c.address1 is not null;
20706:
20707: cursor c_addr_ps is
20708: select b2c.import_source_line_id,max(loc.location_id)
20709: from hz_party_sites ps, hz_locations loc,ams_hz_b2c_mapping_v b2c
20710: where b2c.import_list_header_id = p_import_list_header_id
20711: and b2c.load_status in ('ACTIVE','RELOAD')
20712: and b2c.address_key is not null
20713: and b2c.person_party_id is not null
20719: group by b2c.import_source_line_id;
20720:
20721: cursor c_addr is
20722: select b2c.import_source_line_id,max(loc.location_id)
20723: from hz_locations loc,ams_hz_b2c_mapping_v b2c
20724: where b2c.import_list_header_id = p_import_list_header_id
20725: and b2c.load_status in ('ACTIVE','RELOAD')
20726: and b2c.address_key is not null
20727: and b2c.party_location_id is null
20746:
20747: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20748: EXIT;
20749: END IF;
20750: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
20751: SET address_key = L_address_KEY(I)
20752: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20753:
20754: if l_last_fetch then
20774:
20775: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20776: EXIT;
20777: END IF;
20778: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
20779: SET party_location_id = L_PARTY_location_ID(I)
20780: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20781:
20782: if l_last_fetch then
20803:
20804: IF L_IMPORT_SOURCE_LINE_ID.COUNT = 0 AND l_last_fetch THEN
20805: EXIT;
20806: END IF;
20807: FORALL i IN L_IMPORT_SOURCE_LINE_ID.FIRST..L_IMPORT_SOURCE_LINE_ID.LAST UPDATE AMS_HZ_B2C_MAPPING_V
20808: SET party_location_id = L_PARTY_location_ID(I)
20809: WHERE IMPORT_SOURCE_LINE_ID = L_IMPORT_SOURCE_LINE_ID(i);
20810:
20811: if l_last_fetch then
21196: cursor c_b2c_ph_no is
21197: select IMPORT_SOURCE_LINE_ID ,
21198: hz_phone_number_pkg.transpose(PHONE_COUNTRY_CODE||PHONE_AREA_CODE||PHONE_NUMBER) "TRANS_PHONE_NUMBER"
21199: from
21200: ams_hz_b2c_mapping_v
21201: where import_list_header_id = p_import_list_header_id
21202: and phone_number is not null
21203: and TRANSPOSED_PHONE_NUMBER is null
21204: and load_status in ('ACTIVE','RELOAD');
21294: and load_status = 'RELOAD';
21295:
21296: cursor c_b2cxmlrec is
21297: select per_imp_xml_element_id, add_imp_xml_element_id,cp_imp_xml_element_id, em_imp_xml_element_id
21298: from ams_hz_b2c_mapping_v
21299: where import_list_header_id = p_import_list_header_id
21300: and load_status = 'RELOAD';
21301:
21302: begin