The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE update_int_tables ( p_batch_id IN NUMBER,
p_tab_name IN VARCHAR2,
p_orig_system IN VARCHAR2,
p_orig_system_osr IN VARCHAR2,
p_dup_os_val IN VARCHAR2,
p_dup_osr_val IN VARCHAR2,
p_action_on_entity IN VARCHAR2
);
SELECT dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity ;
select distinct winner_record_os, winner_record_osr
from hz_imp_int_dedup_results
where batch_id = p_batch_id
and entity = p_entity
group by winner_record_os,winner_record_osr;
SELECT DUP_RECORD_OS, DUP_RECORD_OSR
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity
AND nvl(dup_last_update_date,sysdate) = ( SELECT MAX( nvl(DUP_LAST_UPDATE_DATE,sysdate))
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id =p_batch_id
and entity = p_entity
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr )
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr
AND rownum =1;
SELECT DUP_RECORD_OS, DUP_RECORD_OSR
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity
AND nvl(dup_creation_date,sysdate) = ( SELECT MAX( nvl(DUP_CREATION_DATE,sysdate))
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id =p_batch_id
and entity = p_entity
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr )
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr
AND rownum =1;
SELECT DUP_RECORD_OS, DUP_RECORD_OSR
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity
AND nvl(dup_creation_date,sysdate) = ( SELECT MIN( nvl(DUP_CREATION_DATE,sysdate))
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id =p_batch_id
and entity = p_entity
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr )
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr
AND rownum =1;
SELECT party_orig_system, party_orig_system_reference
FROM HZ_IMP_PARTIES_INT
WHERE batch_id = p_batch_id
AND interface_status = 'R'
;
SELECT site_orig_system, site_orig_system_reference
FROM HZ_IMP_ADDRESSES_INT
WHERE batch_id = p_batch_id
AND interface_status = 'R';
SELECT contact_orig_system, contact_orig_system_reference
FROM HZ_IMP_CONTACTS_INT
WHERE batch_id = p_batch_id
AND interface_status = 'R';
hz_utility_v2pub.debug(p_message=>'update interface tables for action=remove_all (+)',
p_prefix=>l_debug_prefix,
p_msg_level=>fnd_log.level_procedure);
UPDATE HZ_IMP_PARTIES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND( party_orig_system, party_orig_system_reference ) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
--AND result.dup_record_os = result.winner_record_os --Bug3339642.
--AND result.dup_record_osr <> result.winner_record_osr --Bug3339642.
AND result.entity = 'PARTY');
UPDATE HZ_IMP_ADDRESSES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND( site_orig_system, site_orig_system_reference ) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
--AND result.dup_record_os = result.winner_record_os --Bug3339642.
--AND result.dup_record_osr <> result.winner_record_osr --Bug3339642.
AND result.entity = 'PARTY_SITES');
UPDATE HZ_IMP_CONTACTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND( contact_orig_system,contact_orig_system_reference) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
--AND result.dup_record_os = result.winner_record_os --Bug3339642.
--AND result.dup_record_osr <> result.winner_record_osr --Bug3339642.
AND result.entity = 'CONTACTS');
UPDATE HZ_IMP_CONTACTPTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND(cp_orig_system ,cp_orig_system_reference) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
--AND result.dup_record_os = result.winner_record_os --Bug3339642.
--AND result.dup_record_osr <> result.winner_record_osr --Bug3339642.
AND result.entity = 'CONTACT_POINTS');
IF p_action_on_entity = 'KEEP_LATEST_UPDATED' THEN
--Select the record with max dup_last_update_date
OPEN max_last_date(p_batch_id, p_entity, l_winner_record_os(i), l_winner_record_osr(i));
UPDATE HZ_IMP_INT_DEDUP_RESULTS
SET WINNER_RECORD_OS = l_rec_os ,WINNER_RECORD_OSR = l_rec_osr
WHERE batch_id = p_batch_id
AND entity = p_entity
AND WINNER_RECORD_OS = l_winner_record_os(i)
AND WINNER_RECORD_OSR = l_winner_record_osr(i) ;
UPDATE HZ_IMP_PARTIES_INT party
SET INTERFACE_STATUS = 'R'
WHERE batch_id = p_batch_id
AND( party_orig_system, party_orig_system_reference ) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
AND result.entity = 'PARTY'
AND result.dup_record_osr <> l_rec_osr
AND WINNER_RECORD_OS = l_rec_os
AND WINNER_RECORD_OSR = l_rec_osr );
UPDATE HZ_IMP_ADDRESSES_INT
SET INTERFACE_STATUS = 'R'
WHERE batch_id = p_batch_id
AND( site_orig_system, site_orig_system_reference ) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
AND result.entity = 'PARTY_SITES'
AND result.dup_record_osr <> l_rec_osr
AND WINNER_RECORD_OS = l_rec_os
AND WINNER_RECORD_OSR = l_rec_osr ) ;
UPDATE HZ_IMP_CONTACTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND ( contact_orig_system,contact_orig_system_reference ) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
AND result.entity = 'CONTACTS'
AND result.dup_record_osr <> l_rec_osr
AND WINNER_RECORD_OS = l_rec_os
AND WINNER_RECORD_OSR = l_rec_osr ) ;
UPDATE HZ_IMP_CONTACTPTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND ( cp_orig_system, cp_orig_system_reference ) in
( select dup_record_os, dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS result
WHERE result.batch_id = p_batch_id
AND result.entity = 'CONTACT_POINTS'
AND result.dup_record_osr <> l_rec_osr
AND WINNER_RECORD_OS = l_rec_os
AND WINNER_RECORD_OSR = l_rec_osr ) ;
UPDATE HZ_IMP_ADDRESSES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_ADDRESSUSES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_CONTACTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND ((sub_orig_system = l_record_os(i)
AND sub_orig_system_reference = l_record_osr(i))
OR
(obj_orig_system = l_record_os(i)
AND obj_orig_system_reference = l_record_osr(i))
);
UPDATE HZ_IMP_CONTACTPTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_RELSHIPS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND ((sub_orig_system = l_record_os(i)
AND sub_orig_system_reference = l_record_osr(i))
OR
(obj_orig_system = l_record_os(i)
AND obj_orig_system_reference = l_record_osr(i))
);
UPDATE HZ_IMP_CLASSIFICS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_CREDITRTNGS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_FINNUMBERS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_FINREPORTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_record_os(i)
AND party_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_ADDRESSUSES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND site_orig_system = l_record_os(i)
AND site_orig_system_reference = l_record_osr(i);
UPDATE HZ_IMP_CONTACTROLES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND contact_orig_system = l_record_os(i)
AND contact_orig_system_reference = l_record_osr(i);
* PRIVATE PROCEDURE update_int_tables
*
* DESCRIPTION
* private procedure to update the interface_status of
* interface tables.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
* p_batch_id Interface Batch ID.
* p_tab_name Interface table name.
* p_orig_system Orig System of the duplicate record in
* Interface table.
* p_orig_system_reference Orig system reference of the duplicate
* record in Interface table.
* p_dup_os_val Orig System Value
* p_dup_osr_val Orig system reference Value.
* p_action_on_entity Action on entities.
*
* MODIFICATION HISTORY
*
* 08-17-2003 Rajeshwari P o Created.
*
*/
/* Commented out for bug 4673725. Also removed the lines that caused
SQL literal problem to avoid false positive.
PROCEDURE update_int_tables (
p_batch_id IN NUMBER,
p_tab_name IN VARCHAR2,
p_orig_system IN VARCHAR2,
p_orig_system_osr IN VARCHAR2,
p_dup_os_val IN VARCHAR2,
p_dup_osr_val IN VARCHAR2,
p_action_on_entity IN VARCHAR2
) IS
l_debug_prefix VARCHAR2(30) := '';
hz_utility_v2pub.debug(p_message=>'update interface tables (+)',
p_prefix=>l_debug_prefix,
p_msg_level=>fnd_log.level_procedure);
hz_utility_v2pub.debug(p_message=>'update interface tables (-)',
p_prefix=>l_debug_prefix,
p_msg_level=>fnd_log.level_procedure);
END update_int_tables;
* private procedure to update the interface tables with
* appropriate actions after DQM has performed registry
* de-duplication.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
* p_batch_id Interface Batch ID.
* p_action_new_parties Action on new parties.
* Insert - Default
* Remove - remove from parties interface table
* and all its child entities.
* p_action__existing_parties Action on existing parties.
* Update - Default
* Remove - remove from parties interface table
* and all its child entities.
* p_action_dup_parties Action on duplicate parties.
* Auto Merge - Default
* Request Merge
* Insert
* Remove
* p_action_pot_dup_parties Action on potential duplicates.
* Request Merge - Default
* Insert
* Remove
*
* OUT:
* x_return_status Return status after the call.
*
* MODIFICATION HISTORY
*
* 08-25-2003 Rajeshwari P o Created.
*
*/
PROCEDURE reg_action_on_party( p_batch_id IN NUMBER,
p_action_new_parties IN VARCHAR2,
p_action_existing_parties IN VARCHAR2,
p_action_dup_parties IN VARCHAR2,
p_action_pot_dup_parties IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
) IS
new_party_sql VARCHAR2(4000);
new_party_sql := 'select int.party_id,int.party_orig_system,int.party_orig_system_reference '||
'from hz_imp_parties_int int, hz_imp_parties_sg stage '||
'where int.batch_id = :p_batch_id ' ||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag IS NULL '||
'AND stage.action_flag = ''I'' ';
existing_party_sql := 'select int.party_id,int.party_orig_system,int.party_orig_system_reference '||
'from hz_imp_parties_int int, hz_imp_parties_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'AND stage.action_flag = ''U'' ';
dup_party_sql := 'select int.party_id,int.party_orig_system,int.party_orig_system_reference '||
'from hz_imp_parties_int int, hz_imp_parties_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag = ''D'' ' ||
'AND stage.action_flag = ''I'' ';
pot_dup_party_sql := 'select int.party_id,int.party_orig_system,int.party_orig_system_reference '||
'from hz_imp_parties_int int, hz_imp_parties_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag = ''P'' '||
'AND stage.action_flag = ''I'' ';
* private procedure to update the interface tables with
* appropriate actions after DQM has performed registry
* de-duplication.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
* p_batch_id Interface Batch ID.
* p_action_new_addrs Action on new sites.
* Insert - Default
* Remove - remove from Address interface table
* and all its child entities.
* p_action__existing_addrs Action on existing sites.
* Update - Default
* Remove - remove from parties interface table
* and all its child entities.
* p_action_pot_dup_addrs Action on potential duplicates.
* Request Merge - Default
* Insert
* Remove
*
* OUT:
* x_return_status Return status after the call.
*
* MODIFICATION HISTORY
*
* 08-25-2003 Rajeshwari P o Created.
*
*/
PROCEDURE reg_action_on_sites ( p_batch_id IN NUMBER,
p_action_new_addrs IN VARCHAR2,
p_action_existing_addrs IN VARCHAR2,
p_action_pot_dup_addrs IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
) IS
new_site_sql VARCHAR2(4000);
new_site_sql := 'select int.site_orig_system,int.site_orig_system_reference '||
'from hz_imp_addresses_int int, hz_imp_addresses_sg stage '||
'where int.batch_id = :p_batch_id ' ||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag IS NULL '||
'AND stage.action_flag = ''I'' ';
existing_site_sql := 'select int.site_orig_system,int.site_orig_system_reference '||
'from hz_imp_addresses_int int, hz_imp_addresses_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'AND stage.action_flag = ''U'' ';
pot_dup_site_sql := 'select int.site_orig_system,int.site_orig_system_reference '||
'from hz_imp_addresses_int int, hz_imp_addresses_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag = ''P'' '||
'AND stage.action_flag = ''I'' ';
* private procedure to update the interface tables with
* appropriate actions after DQM has performed registry
* de-duplication.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
* p_batch_id Interface Batch ID.
* p_action_new_contacts Action on new contacts.
* Insert - Default
* Remove - remove from Contact interface table
* and all its child entities.
* p_action__existing_contacts Action on existing contacts.
* Update - Default
* Remove - remove from parties interface table
* and all its child entities.
* p_action_pot_dup_contacts Action on potential duplicates.
* Request Merge - Default
* Insert
* Remove
*
* OUT:
* x_return_status Return status after the call.
*
* MODIFICATION HISTORY
*
* 08-25-2003 Rajeshwari P o Created.
*
*/
PROCEDURE reg_action_on_cont ( p_batch_id IN NUMBER,
p_action_new_contacts IN VARCHAR2,
p_action_existing_contacts IN VARCHAR2,
p_action_pot_dup_contacts IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
) IS
new_cont_sql VARCHAR2(4000);
new_cont_sql := 'select int.contact_orig_system,int.contact_orig_system_reference '||
'from hz_imp_contacts_int int, hz_imp_contacts_sg stage '||
'where int.batch_id = :p_batch_id ' ||
'and int.batch_id = stage.batch_id '||
'and int.rowid= stage.int_row_id '||
'and int.dqm_action_flag IS NULL '||
'AND stage.action_flag = ''I'' ';
existing_cont_sql := 'select int.contact_orig_system,int.contact_orig_system_reference '||
'from hz_imp_contacts_int int, hz_imp_contacts_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid= stage.int_row_id '||
'AND stage.action_flag = ''U'' ';
pot_dup_cont_sql := 'select int.contact_orig_system,int.contact_orig_system_reference '||
'from hz_imp_contacts_int int, hz_imp_contacts_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid= stage.int_row_id '||
'and int.dqm_action_flag = ''P'' '||
'AND stage.action_flag = ''I'' ';
* private procedure to update the interface tables with
* appropriate actions after DQM has performed registry
* de-duplication.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
* p_batch_id Interface Batch ID.
* p_action_new_cpts Action on new contacts.
* Insert - Default
* Remove - remove from Contact interface table
* and all its child entities.
* p_action__existing_cpts Action on existing contacts.
* Update - Default
* Remove - remove from parties interface table
* and all its child entities.
* p_action_pot_dup_cpts Action on potential duplicates.
* Request Merge - Default
* Insert
* Remove
*
* OUT:
* x_return_status Return status after the call.
*
* MODIFICATION HISTORY
*
* 08-25-2003 Rajeshwari P o Created.
*
*/
PROCEDURE reg_action_on_cpts ( p_batch_id IN NUMBER,
p_action_new_cpts IN VARCHAR2,
p_action_existing_cpts IN VARCHAR2,
p_action_pot_dup_cpts IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
) IS
new_cpts_sql VARCHAR2(4000);
new_cpts_sql := 'select int.cp_orig_system,int.cp_orig_system_reference '||
'from hz_imp_contactpts_int int, hz_imp_contactpts_sg stage '||
'where int.batch_id = :p_batch_id ' ||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag IS NULL '||
'AND stage.action_flag = ''I'' ';
existing_cpts_sql := 'select int.cp_orig_system,int.cp_orig_system_reference '||
'from hz_imp_contactpts_int int, hz_imp_contactpts_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'AND stage.action_flag = ''U'' ';
pot_dup_cpts_sql := 'select int.cp_orig_system,int.cp_orig_system_reference '||
'from hz_imp_contactpts_int int, hz_imp_contactpts_sg stage '||
'where int.batch_id = :p_batch_id '||
'and int.batch_id = stage.batch_id '||
'and int.rowid = stage.int_row_id '||
'and int.dqm_action_flag = ''P'' '||
'AND stage.action_flag = ''I'' ';
* private procedure to update the interface tables with
* appropriate actions after DQM has performed registry
* de-duplication.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
*
*
* OUT:
* x_return_status Return status after the call.
*
* MODIFICATION HISTORY
*
* 08-26-2003 Rajeshwari P o Created.
*
*/
PROCEDURE reg_action_on_supents (x_return_status OUT NOCOPY VARCHAR2) is
TYPE sel_cur IS REF CURSOR;
sel_use := 'SELECT int_row_id FROM HZ_IMP_ADDRESSUSES_SG WHERE action_flag = ''I'' ';
sel_use := 'SELECT int_row_id FROM HZ_IMP_ADDRESSUSES_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_ADDRESSUSES_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
sel_class := 'SELECT int_row_id FROM HZ_IMP_CLASSIFICS_SG WHERE action_flag = ''I'' ';
sel_class := 'SELECT int_row_id FROM HZ_IMP_CLASSIFICS_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_CLASSIFICS_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
sel_roles := 'SELECT int_row_id FROM HZ_IMP_CONTACTROLES_SG WHERE action_flag = ''I'' ';
sel_roles := 'SELECT int_row_id FROM HZ_IMP_CONTACTROLES_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_CONTACTROLES_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
sel_rel := 'SELECT int_row_id FROM HZ_IMP_RELSHIPS_SG WHERE action_flag = ''I'' ';
sel_rel := 'SELECT int_row_id FROM HZ_IMP_RELSHIPS_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_RELSHIPS_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
* private procedure to update the interface tables with
* appropriate actions after DQM has performed registry
* de-duplication.
*
* EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
*
* ARGUMENTS
* IN:
*
*
* OUT:
* x_return_status Return status after the call.
*
* MODIFICATION HISTORY
*
* 08-25-2003 Rajeshwari P o Created.
*
*/
PROCEDURE reg_action_on_finents (
x_return_status OUT NOCOPY VARCHAR2
) is
TYPE sel_cur IS REF CURSOR;
sel_finreports := 'SELECT int_row_id FROM HZ_IMP_FINREPORTS_SG WHERE action_flag = ''I'' ';
sel_finreports := 'SELECT int_row_id FROM HZ_IMP_FINREPORTS_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_FINREPORTS_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
sel_finnumbers := 'SELECT int_row_id FROM HZ_IMP_FINNUMBERS_SG WHERE action_flag = ''I'' ';
sel_finnumbers := 'SELECT int_row_id FROM HZ_IMP_FINNUMBERS_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_FINNUMBERS_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
sel_credit := 'SELECT int_row_id FROM HZ_IMP_CREDITRTNGS_SG WHERE action_flag = ''I'' ';
sel_credit := 'SELECT int_row_id FROM HZ_IMP_CREDITRTNGS_SG WHERE action_flag = ''U'' ';
UPDATE HZ_IMP_CREDITRTNGS_INT
SET interface_status = 'R'
WHERE rowid = l_int_rowid(i) ;
Cursor select_party_rec(p_batch_id IN NUMBER ,p_entity IN VARCHAR2 ) is
select dup_record_os,dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND ENTITY = p_entity
UNION
SELECT party_osr,party_os
FROM HZ_IMP_DUP_PARTIES
WHERE batch_id= p_batch_id
;
Cursor select_detail_rec(p_batch_id IN NUMBER ,p_entity IN VARCHAR2 ) is
select dup_record_os,dup_record_osr
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND ENTITY = p_entity
UNION
SELECT record_os,record_osr
FROM HZ_IMP_DUP_DETAILS
WHERE batch_id= p_batch_id
AND entity= p_entity
;
Open select_party_rec( p_batch_id , 'PARTY' ) ;
Fetch select_party_rec BULK COLLECT into
l_dup_os_party,l_dup_osr_party
LIMIT commit_counter;
IF select_party_rec%NOTFOUND THEN
l_last_fetch := TRUE;
UPDATE HZ_IMP_PARTIES_INT
SET interface_status = NULL,dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND party_orig_system = l_dup_os_party(i)
AND party_orig_system_reference = l_dup_osr_party(i)
AND ( interface_status = 'R' OR dqm_action_flag is not NULL );
UPDATE HZ_IMP_CLASSIFICS_INT
SET interface_status = NULL
WHERE batch_id = p_batch_id
AND party_orig_system = l_dup_os_party(i)
AND party_orig_system_reference = l_dup_osr_party(i)
AND interface_status = 'R' ;
UPDATE HZ_IMP_CREDITRTNGS_INT
SET interface_status = NULL
WHERE batch_id = p_batch_id
AND party_orig_system = l_dup_os_party(i)
AND party_orig_system_reference = l_dup_osr_party(i)
AND interface_status = 'R' ;
UPDATE HZ_IMP_FINNUMBERS_INT
SET interface_status = NULL
WHERE batch_id = p_batch_id
AND party_orig_system = l_dup_os_party(i)
AND party_orig_system_reference = l_dup_osr_party(i)
AND interface_status = 'R' ;
UPDATE HZ_IMP_FINREPORTS_INT
SET interface_status = NULL
WHERE batch_id = p_batch_id
AND party_orig_system = l_dup_os_party(i)
AND party_orig_system_reference = l_dup_osr_party(i)
AND interface_status = 'R' ;
close select_party_rec;
Open select_detail_rec ( p_batch_id ,'PARTY_SITES' );
FETCH select_detail_rec BULK COLLECT INTO
l_dup_os_sites,l_dup_osr_sites
LIMIT commit_counter;
IF select_detail_rec%NOTFOUND THEN
l_last_fetch := TRUE;
UPDATE HZ_IMP_ADDRESSES_INT
SET interface_status = NULL,dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND site_orig_system = l_dup_os_sites(i)
AND site_orig_system_reference = l_dup_osr_sites(i)
AND ( interface_status = 'R' OR dqm_action_flag is not NULL );
UPDATE HZ_IMP_ADDRESSUSES_INT
SET interface_status = NULL
WHERE batch_id = p_batch_id
AND site_orig_system = l_dup_os_sites(i)
AND site_orig_system_reference = l_dup_osr_sites(i)
AND interface_status = 'R' ;
close select_detail_rec;
Open select_detail_rec ( p_batch_id ,'CONTACTS' );
FETCH select_detail_rec BULK COLLECT INTO
l_dup_os_cont,l_dup_osr_cont
LIMIT commit_counter;
IF select_detail_rec%NOTFOUND THEN
l_last_fetch := TRUE;
UPDATE HZ_IMP_CONTACTS_INT
SET interface_status = NULL,dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND contact_orig_system = l_dup_os_cont(i)
AND contact_orig_system_reference = l_dup_osr_cont(i)
AND ( interface_status = 'R' OR dqm_action_flag is not NULL );
UPDATE HZ_IMP_CONTACTROLES_INT
SET interface_status = NULL
WHERE batch_id = p_batch_id
AND contact_orig_system = l_dup_os_cont(i)
AND contact_orig_system_reference = l_dup_osr_cont(i)
AND interface_status = 'R' ;
close select_detail_rec;
Open select_detail_rec ( p_batch_id ,'CONTACT_POINTS' );
FETCH select_detail_rec BULK COLLECT INTO
l_dup_os_cp,l_dup_osr_cp
LIMIT commit_counter;
IF select_detail_rec%NOTFOUND THEN
l_last_fetch := TRUE;
UPDATE HZ_IMP_CONTACTPTS_INT
SET interface_status = NULL,dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND cp_orig_system = l_dup_os_cp(i)
AND cp_orig_system_reference = l_dup_osr_cp(i)
AND ( interface_status = 'R' OR dqm_action_flag is not NULL );
close select_detail_rec;
SELECT BD_ACTION_ON_PARTIES,BD_ACTION_ON_ADDRESSES,
BD_ACTION_ON_CONTACTS,BD_ACTION_ON_CONTACT_POINTS
FROM hz_imp_batch_summary
WHERE batch_id = p_batch_id;
hz_utility_v2pub.debug(p_message=>'update the interface tables after batch deduplication (+) ',
p_prefix=>l_debug_prefix,
p_msg_level=>fnd_log.level_procedure);
UPDATE HZ_IMP_BATCH_SUMMARY
SET BD_ACTION_ON_PARTIES = p_action_on_parties
WHERE batch_id = p_batch_id;
UPDATE HZ_IMP_BATCH_SUMMARY
SET BD_ACTION_ON_ADDRESSES = p_action_on_addresses
WHERE batch_id = p_batch_id;
UPDATE HZ_IMP_BATCH_SUMMARY
SET BD_ACTION_ON_CONTACTS = p_action_on_contacts
WHERE batch_id = p_batch_id;
UPDATE HZ_IMP_BATCH_SUMMARY
SET BD_ACTION_ON_CONTACT_POINTS = p_action_on_contact_points
WHERE batch_id = p_batch_id;
hz_utility_v2pub.debug(p_message=>'update the interface tables after batch deduplication (+) ',
p_prefix=>l_debug_prefix,
p_msg_level=>fnd_log.level_procedure);
SELECT DUP_RECORD_OS, DUP_RECORD_OSR
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity
AND nvl(dup_last_update_date,sysdate) = ( SELECT MAX( nvl(DUP_LAST_UPDATE_DATE,sysdate))
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id =p_batch_id
and entity = p_entity
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr)
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr
AND rownum =1;
SELECT DUP_RECORD_OS, DUP_RECORD_OSR
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity
AND nvl(dup_creation_date,sysdate) = ( SELECT MAX( nvl(DUP_CREATION_DATE,sysdate))
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id =p_batch_id
AND entity = p_entity
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr)
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr
AND rownum =1;
SELECT DUP_RECORD_OS, DUP_RECORD_OSR
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id = p_batch_id
AND entity = p_entity
AND nvl(dup_creation_date,sysdate) = ( SELECT MIN( nvl(DUP_CREATION_DATE,sysdate))
FROM HZ_IMP_INT_DEDUP_RESULTS
WHERE batch_id =p_batch_id
AND entity = p_entity
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr)
AND winner_record_os = p_winner_record_os
AND winner_record_osr = p_winner_record_osr
AND rownum =1;
SELECT MEANING FROM FND_LOOKUP_VALUES lkp
WHERE lkp.lookup_code=p_lkp_code
AND lkp.lookup_type='HZ_IMP_BATCH_DEDUP_STATUS'
AND lkp.language = userenv('LANG')
AND lkp.view_application_id = 222
AND lkp.security_group_id =fnd_global.lookup_security_group('HZ_IMP_BATCH_DEDUP_STATUS', 222)
AND rownum=1;
IF p_action_on_entity='KEEP_LATEST_UPDATED' THEN
OPEN max_last_date;
UPDATE HZ_IMP_PARTIES_INT party
SET INTERFACE_STATUS = 'R', dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND ((party_id IS NULL and l_party_id(i) IS NULL)
OR (party_id IS NOT NULL and l_party_id(i) IS NOT NULL and party_id=l_party_id(i)))
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_CLASSIFICS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_CREDITRTNGS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_FINNUMBERS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_FINREPORTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
(p_action_dup_parties = 'REMOVE' or p_action_dup_parties = 'INSERT' ) )
or
(p_action_pot_dup_parties <> NULL and
(p_action_pot_dup_parties = 'REMOVE' or p_action_pot_dup_parties = 'INSERT' ) )
THEN
FORALL i in l_party_orig_osr.FIRST..l_party_orig_osr.LAST
UPDATE HZ_IMP_DUP_PARTIES
SET auto_merge_flag = 'R'
WHERE batch_id = p_batch_id
AND party_id = l_party_id(i)
AND party_os = l_party_orig_os(i)
AND party_osr = l_party_orig_osr(i) ;
UPDATE HZ_IMP_ADDRESSES_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i)
RETURNING site_orig_system,site_orig_system_Reference BULK COLLECT into l_site_orig_os,l_site_orig_osr;
UPDATE HZ_IMP_ADDRESSUSES_INT
SET INTERFACE_STATUS = 'R'
WHERE batch_id = p_batch_id
AND site_orig_system = l_site_orig_os(i)
AND site_orig_system_reference = l_site_orig_osr(i) ;
UPDATE HZ_IMP_CONTACTPTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_RELSHIPS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND (sub_orig_system = l_party_orig_os(i)
AND sub_orig_system_reference = l_party_orig_osr(i))
OR
(obj_orig_system = l_party_orig_os(i)
AND obj_orig_system_reference = l_party_orig_osr(i));
UPDATE HZ_IMP_CONTACTS_INT
SET interface_status = 'R'
WHERE batch_id = p_batch_id
AND (sub_orig_system = l_party_orig_os(i)
AND sub_orig_system_reference = l_party_orig_osr(i))
OR
(obj_orig_system = l_party_orig_os(i)
AND obj_orig_system_reference = l_party_orig_osr(i))
RETURNING contact_orig_system,contact_orig_system_reference BULK COLLECT into l_cont_orig_os,l_cont_orig_osr;
UPDATE HZ_IMP_CONTACTROLES_INT
SET INTERFACE_STATUS = 'R'
WHERE batch_id = p_batch_id
AND contact_orig_system = l_cont_orig_os(i)
AND contact_orig_system_reference = l_cont_orig_osr(i) ;
IF ( (p_action_dup_parties <> NULL and p_action_dup_parties = 'INSERT' )
OR
(p_action_pot_dup_parties <> NULL and p_action_pot_dup_parties = 'INSERT' )
)
THEN
FORALL i in l_party_orig_osr.FIRST..l_party_orig_osr.LAST
UPDATE HZ_IMP_PARTIES_INT
SET dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND party_id = l_party_id(i)
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_PARTIES_INT
SET dqm_action_flag = 'P'
WHERE batch_id = p_batch_id
AND party_id = l_party_id(i)
AND party_orig_system = l_party_orig_os(i)
AND party_orig_system_reference = l_party_orig_osr(i) ;
UPDATE HZ_IMP_DUP_PARTIES
SET auto_merge_flag = 'N'
WHERE batch_id = p_batch_id
AND party_id = l_party_id(i)
AND party_os = l_party_orig_os(i)
AND party_osr = l_party_orig_osr(i) ;
UPDATE HZ_IMP_ADDRESSES_INT
SET INTERFACE_STATUS = 'R', dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND site_orig_system = l_site_orig_os(i)
AND site_orig_system_reference = l_site_orig_osr(i) ;
UPDATE HZ_IMP_ADDRESSUSES_INT
SET INTERFACE_STATUS = 'R'
WHERE batch_id = p_batch_id
AND site_orig_system = l_site_orig_os(i)
AND site_orig_system_reference = l_site_orig_osr(i) ;
(p_action_pot_dup_addrs = 'REMOVE' or p_action_pot_dup_addrs = 'INSERT' ) )
THEN
FORALL i in l_site_orig_osr.FIRST..l_site_orig_osr.LAST
DELETE FROM HZ_IMP_DUP_DETAILS
WHERE batch_id = p_batch_id
AND record_os = l_site_orig_os(i)
AND record_osr = l_site_orig_osr(i) ;
IF (p_action_pot_dup_addrs <> NULL and p_action_pot_dup_addrs = 'INSERT' )
THEN
FORALL i in l_site_orig_osr.FIRST..l_site_orig_osr.LAST
UPDATE HZ_IMP_ADDRESSES_INT
SET dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND site_orig_system = l_site_orig_os(i)
AND site_orig_system_reference = l_site_orig_osr(i) ;
UPDATE HZ_IMP_CONTACTS_INT
SET INTERFACE_STATUS = 'R', dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND contact_orig_system = l_cont_orig_os(i)
AND contact_orig_system_reference = l_cont_orig_osr(i) ;
UPDATE HZ_IMP_CONTACTROLES_INT
SET INTERFACE_STATUS = 'R'
WHERE batch_id = p_batch_id
AND contact_orig_system = l_cont_orig_os(i)
AND contact_orig_system_reference = l_cont_orig_osr(i) ;
(p_action_pot_dup_contacts = 'REMOVE' or p_action_pot_dup_contacts = 'INSERT' ) )
THEN
FORALL i in l_cont_orig_osr.FIRST..l_cont_orig_osr.LAST
DELETE FROM HZ_IMP_DUP_DETAILS
WHERE batch_id = p_batch_id
AND record_os = l_cont_orig_os(i)
AND record_osr = l_cont_orig_osr(i) ;
IF (p_action_pot_dup_contacts <> NULL and p_action_pot_dup_contacts = 'INSERT' )
THEN
FORALL i in l_cont_orig_osr.FIRST..l_cont_orig_osr.LAST
UPDATE HZ_IMP_CONTACTS_INT
SET dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND contact_orig_system = l_cont_orig_os(i)
AND contact_orig_system_reference = l_cont_orig_osr(i) ;
UPDATE HZ_IMP_CONTACTPTS_INT
SET INTERFACE_STATUS = 'R', dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND cp_orig_system = l_cpts_orig_os(i)
AND cp_orig_system_reference = l_cpts_orig_osr(i) ;
(p_action_pot_dup_cpts = 'REMOVE' or p_action_pot_dup_cpts = 'INSERT' ) )
THEN
FORALL i in l_cpts_orig_osr.FIRST..l_cpts_orig_osr.LAST
DELETE FROM HZ_IMP_DUP_DETAILS
WHERE batch_id = p_batch_id
AND record_os = l_cpts_orig_os(i)
AND record_osr = l_cpts_orig_osr(i) ;
IF (p_action_pot_dup_cpts <> NULL and p_action_pot_dup_cpts = 'INSERT' )
THEN
FORALL i in l_cpts_orig_osr.FIRST..l_cpts_orig_osr.LAST
UPDATE HZ_IMP_CONTACTPTS_INT
SET dqm_action_flag = NULL
WHERE batch_id = p_batch_id
AND cp_orig_system = l_cpts_orig_os(i)
AND cp_orig_system_reference = l_cpts_orig_osr(i) ;