Thursday, 17 January 2019

Address Formatting SQL

 select IPA.PAYEE_ADDRESS1
||decode(IPA.PAYEE_ADDRESS2,NULL,'',', '||IPA.PAYEE_ADDRESS2)
||decode(IPA.PAYEE_ADDRESS3,NULL,'',', '||IPA.PAYEE_ADDRESS3)
||decode(IPA.PAYEE_ADDRESS4,NULL,'',', '||IPA.PAYEE_ADDRESS4)
||decode(IPA.PAYEE_CITY,NULL,'',', '||IPA.PAYEE_CITY)
||decode(IPA.PAYEE_POSTAL_CODE,NULL,'',', '||IPA.PAYEE_POSTAL_CODE)
||decode(IPA.PAYEE_STATE,NULL,'',', '||IPA.PAYEE_STATE)
 addr from iby_payments_all IPA  where IPA.BENEFICIARY_NAME like 'abc'


=========================

select HL.ADDRESS1
||decode(HL.ADDRESS2,NULL,'',', '||HL.ADDRESS2)
||decode(HL.ADDRESS3,NULL,'',', '||HL.ADDRESS3)
||decode(HL.ADDRESS4,NULL,'',', '||HL.ADDRESS4)
||decode(HL.CITY,NULL,'',', '||HL.CITY)
||decode(HL.POSTAL_CODE,NULL,'',', '||HL.POSTAL_CODE)
||decode(HL.STATE,NULL,'',', '||HL.STATE)
||decode(HL.COUNTRY,NULL,'',', '||HL.COUNTRY)
 addr from hz_locations hl  where location_id = <>

No comments:

Post a Comment