DROP PROCEDURE IF EXISTS public.sp_UpdateOrgAddressFromGAR;

CREATE PROCEDURE public.sp_UpdateOrgAddressFromGAR
(
	addressid int,
	aoguid uuid default null::uuid,
	houseguid uuid default null::uuid
)
    language plpgsql
as
$$
DECLARE 
    p_addressid int := addressid;
    p_aoguid uuid := aoguid;
    p_houseguid uuid := houseguid;
Begin

	update akuz.t_org_address  
	set 
		AOGUID = Coalesce(p_aoguid,AOGUID), 
		HouseGUID = Coalesce(p_houseguid,HouseGUID)
	where OrgAddressID = p_addressid;
End;
$$;