You are on page 1of 1

SELECT

cust_v.customer_name
,cust_v.customer_number
,cust_v.cust_account_id
,cust_v.address_id -- SAMUDS 04/14/2016 PRI-806
,cust_v.address1
,(cust_v.address2||' '||cust_v.address3) address2
,(cust_v.city||', '||decode(cust_v.country,'US',cust_v.state,cust_v.coun
try)||' '||cust_v.postal_code) address3 --changed the country to State if it is
US by Sasi.V on 06-23-09
,xssh.show_id
,xssh.show_name
,xssh.show_name||'/'||xsso.occr_id show_name_occr
,to_char(xsso.show_open_date,'mm/dd/yyyy') show_open_date
,to_char(xsso.show_close_date,'mm/dd/yyyy') show_close_date
,xsso.occr_id
,xsso.SHOW_OCCR_ID
,xsoc.SHOW_OCCR_CUST_ID
,xsfh.facility_id
,xsfh.facility_name
,ppa.segment1
,disc.*
FROM xgec_sw_show_hdr xssh ,
xgec_sw_show_occr xsso ,
xgec_sw_occr_cust xsoc ,
xgec_sw_occr_prj xsop ,
pa_projects_all ppa ,
xgec_sw_pub_cust_addr_usage_v cust_v ,
xgec_sw_fclt_hdr xsfh ,
xgec_sw_prj_fclt_main xspfm ,
xgec_ar_inv_cust_info disc ,
oe_order_headers_all ooha
WHERE 1 = 1
--AND
&P_ADDN_WHERE
AND xsoc.ed_flag
='Y'
AND ooha.sales_channel_code
= 'E&D'
AND xssh.show_header_id
= xsso.show_header_id
AND xsso.show_occr_id
= xsoc.show_occr_id
AND xsso.show_occr_id
= xsop.show_occr_id
AND TO_NUMBER (ooha.attribute2) = ppa.project_id(+)
AND xsoc.cust_account_id
= ooha.end_customer_id
AND xsoc.site_use_id
= ooha.end_customer_site_use_id
AND xsoc.show_occr_id
= TO_NUMBER (ooha.attribute1)
AND xsoc.cust_account_id
= cust_v.cust_account_id
AND xsoc.site_use_id
=cust_v.site_use_id ---AND xspfm.show_occr_prj_id
= xsop.show_occr_prj_id--AND xspfm.fclt_hdr_id
= xsfh.fclt_hdr_id
--AND cust_v.cust_account_id
= NVL (:p_customer_name ,cust_v.cust_account_id)
AND cust_v.addr_usg_status
= 'A'
--AND
xsfh.fclt_hdr_id = NVL (:p_facility_code, xsfh.fclt_hdr_id)
AND xsso.show_occr_id
= NVL (:p_show_occur, xsso.show_occr_id)
AND cust_v.site_use_code
= 'BILL_TO'
AND xsoc.show_occr_cust_id IN
(SELECT show_occr_cust_id FROM xgec_sw_cust_cash_pmt_v
)
AND xsso.show_close_date > sysdate -- Added by Balajp on 08/18/2010 for issue 17
3

You might also like