307: cursor dict_update_date is
308: select max(last_update_date) from hz_merge_dictionary;
309:
310: cursor b1 is
311: select subset_sql, attributes_flag from hz_purge_batches where batch_id = to_number(batchid);
312:
313: cursor numparties is
314: select count(*) from hz_purge_gt;
315:
407:
408: num_parties:= i;
409: --dbms_output.put_line('num_parties='||num_parties);
410:
411: update hz_purge_batches set num_candidates=num_parties, num_marked=num_parties, status='IDENTIFICATION_COMPLETE' where batch_id=to_number(batchid);
412: if(regid_flag=true) then
413: open appl_trans;
414: loop
415: FETCH appl_trans into app_id, p_id;
441: WHEN FND_API.G_EXC_ERROR THEN
442: retcode := 2;
443: errbuf := errbuf || logerror||SQLERRM;
444: FND_FILE.close;
445: update hz_purge_batches set status='IDENTIFICATION_ERROR' where batch_id=to_number(batchid);
446: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
447: retcode := 2;
448: errbuf := errbuf || logerror||SQLERRM;
449: FND_FILE.close;
446: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
447: retcode := 2;
448: errbuf := errbuf || logerror||SQLERRM;
449: FND_FILE.close;
450: update hz_purge_batches set status='IDENTIFICATION_ERROR' where batch_id=to_number(batchid);
451: WHEN OTHERS THEN
452: retcode := 2;
453: errbuf := errbuf || logerror||SQLERRM;
454: FND_FILE.close;
451: WHEN OTHERS THEN
452: retcode := 2;
453: errbuf := errbuf || logerror||SQLERRM;
454: FND_FILE.close;
455: update hz_purge_batches set status='IDENTIFICATION_ERROR' where batch_id=to_number(batchid);
456: END;
457:
458: /* To check if a single party has any transactions */
459:
845: update hz_purge_candidates set status='PURGED' where candidate_party_id in (
846: select candidate_party_id from hz_purge_candidates where batch_id=batchid and status='PURGED')
847: and batch_id<>batchid;
848:
849: /* update the status of purged parties in table 'HZ_PURGE_BATCHES to 'PURGE_COMPLETED' */
850: update hz_purge_batches set status='PURGE_COMPLETE',purge_date=sysdate where batch_id=batchid;
851:
852: l_bool := fnd_installation.GET_APP_INFO('AR',l_status,l_tmp,l_schema);
853:
846: select candidate_party_id from hz_purge_candidates where batch_id=batchid and status='PURGED')
847: and batch_id<>batchid;
848:
849: /* update the status of purged parties in table 'HZ_PURGE_BATCHES to 'PURGE_COMPLETED' */
850: update hz_purge_batches set status='PURGE_COMPLETE',purge_date=sysdate where batch_id=batchid;
851:
852: l_bool := fnd_installation.GET_APP_INFO('AR',l_status,l_tmp,l_schema);
853:
854: begin
866: WHEN FND_API.G_EXC_ERROR THEN
867: retcode := 2;
868: errbuf := errbuf || logerror||SQLERRM;
869: FND_FILE.close;
870: update hz_purge_batches set status='PURGE_ERROR' where batch_id=batchid;
871: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
872: retcode := 2;
873: errbuf := errbuf || logerror||SQLERRM;
874: FND_FILE.close;
871: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
872: retcode := 2;
873: errbuf := errbuf || logerror||SQLERRM;
874: FND_FILE.close;
875: update hz_purge_batches set status='PURGE_ERROR' where batch_id=batchid;
876: WHEN OTHERS THEN
877: retcode := 2;
878: errbuf := errbuf || logerror||SQLERRM;
879: FND_FILE.close;
876: WHEN OTHERS THEN
877: retcode := 2;
878: errbuf := errbuf || logerror||SQLERRM;
879: FND_FILE.close;
880: update hz_purge_batches set status='PURGE_ERROR' where batch_id=batchid;
881:
882: END;
883:
884: /* Purge Single Party */