set pagesize 100;
set define ^
;


-- "=============================================="
-- " DELETE the data from OOL charges.            "
-- "=============================================="

delete from t204_cb_ool_charges
 where f_fypd < (select f_fypd13 from t204_bill_fypd)
/
commit
/

delete from t204_cb_ool_details
 where f_fypd < (select f_fypd13 from t204_bill_fypd)
/
commit
/


-- "=============================================="
-- " DELETE the data from LDAP charges.           "
-- "=============================================="

delete from t204_cb_ldap_charges
 where f_fypd < (select f_fypd13 from t204_bill_fypd)
/
commit
/

delete from t204_cb_ldap_details
 where f_fypd < (select f_fypd13 from t204_bill_fypd)
/  
commit
/

delete from t204_tb_dtbill
 where f_fypd < (select f_fypd13 from t204_bill_fypd)
/   

delete from t204_tb_dtbill
 where f_fypd < (select f_fypd13 from t204_bill_fypd)
/   
commit
/

select 'OOL CHARGES: ', f_fypd, count(*) from t204_cb_ool_charges
 group by f_fypd
/ 

select 'OOL DETAILS: ', f_fypd, count(*) from t204_cb_ool_details
 group by f_fypd
/ 

select 'LDAP CHARGES:', f_fypd, count(*) from t204_cb_ldap_charges
 group by f_fypd
/ 

select 'LDAP DETAILS:', f_fypd, count(*) from t204_cb_ldap_details
 group by f_fypd
/ 

select '   TB_DTBILL:', f_fypd, count(*) from t204_tb_dtbill
 group by f_fypd
/

select '   TB_CCBILL:', f_fypd, count(*) from t204_tb_ccbill
 group by f_fypd
/ 

exit;
