set pagesize 100;
--SET MARKUP HTML ON;

SELECT * FROM t204_tb_authcd a
WHERE a.f_loc_c = 'SC'
  AND a.f_div_c = '02'
  AND NOT EXISTS
    (SELECT * FROM genfin_dbo.t951_dpt b
	  WHERE a.f_loc_c = b.f_loc_c
	    AND a.f_div_c = b.f_div_c
            AND a.f_dpt_c = b.f_dpt_c)
  AND EXISTS
    (SELECT * FROM genfin_dbo.t951_dpt c
	  WHERE a.f_loc_c = c.f_loc_c
	    AND '99'      = c.f_div_c
            AND a.f_dpt_c = c.f_dpt_c)
;
exit;

SELECT * FROM t204_tb_authcd a
WHERE a.f_loc_c = 'SC'
  AND NOT EXISTS
    (SELECT * FROM genfin_dbo.t951_dpt b
	  WHERE a.f_loc_c = b.f_loc_c
	    AND a.f_div_c = b.f_div_c
		AND a.f_dpt_c = b.f_dpt_c)
  AND EXISTS
    (SELECT * FROM genfin_dbo.t951_dpt c
	  WHERE c.f_loc_c = 'NA'
	    AND a.f_div_c = c.f_div_c
		AND a.f_dpt_c = c.f_dpt_c)
;
exit;

select a_uid_x, db_upd_d, count(*), sum(f_call_a)
 from t204_tb_dtdata
where a_phone_n = '8439'
group by a_uid_x, db_upd_d
;
exit;

variable c refcursor
exec p204_security.p204_security_rpt  ( 'ABLMSC','ADD','!','IS-ADMIN ','ABLMSC', 'NAME', ' ', :c )
print :c
;
exit;

variable c refcursor
exec p204_cb_gl.p204_cb_gl_rpt  ( 'RPT','200601', :c )
--exec p204_tb_gl.p204_tb_gl_rpt  ( 'RPT','200510', :c )
print :c
;
exit;

SELECT distinct a.a_phone_n
     , a.f_loc_c
     , a.f_div_c
     , a.f_dpt_c
     , a.a_badge_n
     , a.a_uid_x
     , a.a_uid_c
     , b.f_loc_c
     , b.f_div_c
     , b.f_dpt_c
     , b.a_badge_n
     , SUBSTR(b.a_uid_x,1,30)
     , b.a_uid_c
  FROM t204_tb_dtbill a
     , t204_tb_phones b
 where SUBSTR(a.a_phone_n,1,4)  = SUBSTR(b.a_phone_n,5,4)
   AND b.a_phone_n    LIKE '721%'
   AND a.f_fypd = '200512'
   AND (a.a_badge_n <> b.a_badge_n
     or a.a_uid_c   <> b.a_uid_c   
     or a.a_uid_c   is null)       
/
exit;

variable c refcursor
exec p204_tb_fix.p204_tb_fix_rpt  ( :c )
print c
;
exit;

variable c refcursor
exec p204_cb_gl.p204_cb_gl_rpt  ( 'G/L',' ', :c )
--exec p204_tb_gl.p204_tb_gl_rpt  ( 'RPT','200510', :c )
print :c
;
exit;

variable c refcursor
exec p204_tb_dtdata_upd2.p204_tb_dtdata_upd2_rpt  ( :c )
print c
;
exit;

variable c refcursor
exec commbill_dbo.p204_bill_ool_del.p204_bill_ool_del_rpt ('ATT-TDMA-D ', '200512','CELLDETAIL', 'RPT', :c );
print :c
;

exit;

variable c refcursor
exec commbill_dbo.p204_bill_ldap_val.p204_bill_ldap_val_rpt ('ATT-DIALIN', 'AARTSC    ' ,'SCRC2070  ', :c );
print :c
;

exit;

variable c refcursor
exec commbill_dbo.p204_bill_ool_val.p204_bill_ool_val_rpt ('ARCH', '9999999999  ' ,'SCRC2070  ', :c );
print :c
;

exit;

variable c refcursor
exec commbill_dbo.p204_bill_ldap_upd.p204_bill_ldap_upd_rpt ('ATT-TCONF', :c );
print :c
;

exit;

variable c refcursor
exec commbill_dbo.p204_bill_trend.p204_bill_trend_rpt ( :c );
print :c
;

exit;

variable c refcursor
exec commbill_dbo.p204_bill_ool_upd.p204_bill_ool_upd_rpt ( 'ATT-GSM', :c );
print :c
;

exit;

variable c refcursor
exec p204_security.p204_security_rpt  ( 'ABLMSC','ADD','!','IS-ADMIN ','ABLMSC', 'NAME', ' ', :c )
print :c
;

exit;
