Friday, March 9, 2018

SQL - Concatenate string query

SELECT  address_line1 ||','||chr(10)|| nvl2(address_line2, address_line2||','||chr(10),NULL)||city||nvl2(state, state||','||chr(10),NULL)||','||
       nvl2(province, province||','||chr(10),NULL)||chr(10)|| ftt.TERRITORY_SHORT_NAME ||','||assa.zip  address

FROM    ap_supplier_sites_all assa,ap_suppliers aps , fnd_territories_tl ftt
WHERE assa.vendor_id = aps.vendor_id   
 AND     ftt.territory_code = assa.country
 AND     aps.vendor_id =:p_vendor_id
 AND     assa.vendor_site_id =:p_vendor_site_id;

No comments:

Post a Comment