SELECT 10 record_id
,P.vendor_id
,P.vendor_name vendor_name
,P.segment1
,P.enabled_flag
,TO_CHAR(P.creation_date,'DDMMYYYY')creation_date
,P.vendor_type_lookup_code
,P.terms_id
,a.name --payment_terms
,P.payment_priority
,P.invoice_amount_limit
,P.payment_method_lookup_code
,P.num_1099 num_1099
,vat_registration_num vat_registration_num
,TO_CHAR(P.start_date_active,'DDMMYYYY')start_date_active
,TO_CHAR(P.end_date_active,'DDMMYYYY')end_date_active
,hold_all_payments_flag Hold_All_Payments --<M1>
,hold_flag Purchase_Order_Hold --<M1>
--,p.end_date_active end_date --<M1> <M2>
,SUBSTR(P.attribute11,1,INSTR(P.attribute11,'.',1,1)-1) business --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,1)+1,(INSTR (P.attribute11,'.',1,2)- INSTR (P.attribute11,'.',1,1))),'.','')disabled --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,2)+1,(INSTR (P.attribute11,'.',1,3)- INSTR (P.attribute11,'.',1,2))),'.','')disabled_veteran --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,3)+1,(INSTR (P.attribute11,'.',1,4)- INSTR (P.attribute11,'.',1,3))),'.','')disadv_business --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,4)+1,(INSTR (P.attribute11,'.',1,5)- INSTR (P.attribute11,'.',1,4))),'.','')hub_zone --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,5)+1,(INSTR (P.attribute11,'.',1,6)- INSTR (P.attribute11,'.',1,5))),'.','')nmsdc --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,6)+1,(INSTR (P.attribute11,'.',1,7)- INSTR (P.attribute11,'.',1,6))),'.','')small_disadv_business --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,7)+1,(INSTR (P.attribute11,'.',1,8)- INSTR (P.attribute11,'.',1,7))),'.','')cali_utility_comm --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,8)+1,(INSTR (P.attribute11,'.',1,9)- INSTR (P.attribute11,'.',1,8))),'.','')local_muni --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,9)+1,(INSTR (P.attribute11,'.',1,10)- INSTR (P.attribute11,'.',1,9))),'.','')small_business_enterprise --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,10)+1,(INSTR (P.attribute11,'.',1,11)- INSTR (P.attribute11,'.',1,10))),'.','')state --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,11)+1,(INSTR (P.attribute11,'.',1,12)- INSTR (P.attribute11,'.',1,11))),'.','')veteran --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,12)+1,(INSTR (P.attribute11,'.',1,13)- INSTR (P.attribute11,'.',1,12))),'.','')wbenc --<M1>
,REPLACE(SUBSTR(P.attribute11,INSTR(P.attribute11,'.',1,13)+1),'.','')other --<M1>
,p.invoice_currency_code --<M5>
,P.attribute14 Commodity_code --<M6>
,p.attribute3 non_po_supplier_flag --<M7>
,p.attribute1 supplier_creator --<M8>
,p.last_update_date last_updatedate --<M9>
,(CASE WHEN tmp.cnt = 0 THEN 'N'ELSE 'Y'END) ISP_SUPPLIER_FLAG
FROM po_vendors P
,ap_terms a
,(SELECT COUNT(1) cnt
FROM po_vendor_sites_all
WHERE vendor_id = p.vendor_id
AND vendor_site_code = '0 ISP') tmp
WHERE P.terms_id = a.term_id(+)
No comments:
Post a Comment