pears.GetCompanyAddressOnLine
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
Original SQL
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."GetCompanyAddressOnLine" IS {CREATE FUNCTION GetCompanyAddressOnLine /* Application Maintained Function / Procedure - DO NOT EDIT*/ (IN reqcompanyid CHAR(20)) RETURNS CHAR(250) BEGIN DECLARE AddressOnLine CHAR(250); DECLARE addr1 CHAR(40); DECLARE addr2 CHAR(40); DECLARE addr3 CHAR(40); DECLARE town CHAR(30); DECLARE county CHAR(30); DECLARE country CHAR(30); DECLARE postcode CHAR(30); SELECT company.addr1,company.addr2,company.addr3,company.town,company.county,company.country,company.postcode INTO addr1, addr2,addr3,town,county,country,postcode FROM company WHERE companyid=reqcompanyid; IF isnull(addr1,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(addr1) END IF ; IF isnull(AddressOnLine,'')<>'' AND isnull(addr2,'')<>'' THEN SET AddressOnLine=AddressOnLine||', ' END IF ; IF isnull(addr2,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(addr2) END IF ; IF isnull(AddressOnLine,'')<>'' AND isnull(addr3,'')<>'' THEN SET AddressOnLine=AddressOnLine||', ' END IF ; IF isnull(addr3,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(addr3) END IF ; IF isnull(AddressOnLine,'')<>'' AND isnull(town,'')<>'' THEN SET AddressOnLine=AddressOnLine||', ' END IF ; IF isnull(town,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(town) END IF ; IF isnull(AddressOnLine,'')<>'' AND isnull(county,'')<>'' THEN SET AddressOnLine=AddressOnLine||', ' END IF ; IF isnull(county,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(county) END IF ; IF isnull(AddressOnLine,'')<>'' AND isnull(country,'')<>'' THEN SET AddressOnLine=AddressOnLine||', ' END IF ; IF isnull(country,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(country) END IF ; IF isnull(AddressOnLine,'')<>'' AND isnull(postcode,'')<>'' THEN SET AddressOnLine=AddressOnLine||' ' END IF ; IF isnull(postcode,'')<>'' THEN SET AddressOnLine=AddressOnLine||TRIM(postcode) END IF ; RETURN AddressOnLine END }