[Home] [Help]
3412: l_ar_dist_key_value_list gl_ca_utility_pkg.r_key_value_arr;
3413: l_gl_dist_key_value_list gl_ca_utility_pkg.r_key_value_arr;
3414:
3415: /* bug2021662 : added for getting deleted correspondence_id */
3416: TYPE Del_Cid_Tab IS TABLE OF ar_correspondences.correspondence_id%TYPE INDEX BY BINARY_INTEGER;
3417: del_cid Del_Cid_Tab;
3418:
3419: l_corr_row BINARY_INTEGER := 0 ;
3420:
3580: --
3581: DELETE FROM ar_customer_call_topics
3582: WHERE customer_trx_id = p_entity_id ;
3583: --
3584: UPDATE ar_correspondences corr
3585: SET corr.purged_children_flag = 'Y'
3586: WHERE corr.correspondence_id IN
3587: (
3588: SELECT sched.correspondence_id
3604: )
3605: RETURNING correspondence_id BULK COLLECT INTO del_cid ;
3606: --
3607: /* bug2021662 :this DELETE stmt does not work correctly
3608: DELETE FROM ar_correspondences corr
3609: WHERE corr.correspondence_id NOT IN
3610: (
3611: SELECT sched.correspondence_id
3612: FROM ar_correspondence_pay_sched sched,
3620: for gotton correspondence_id
3621: */
3622: IF del_cid.count > 0 THEN
3623: FORALL l_corr_row IN del_cid.FIRST..del_cid.LAST
3624: DELETE FROM ar_correspondences corr
3625: WHERE not exists
3626: (
3627: SELECT 'there are children records'
3628: FROM ar_correspondence_pay_sched sched