CREATE OR REPLACE FUNCTION office.get_offices()
RETURNS SETOF office.office_type
LANGUAGE plpgsql
STABLE
AS $function$
BEGIN
RETURN QUERY
SELECT office_id, office_code,office_name,street || ' ' || city AS Address FROM office.offices
ORDER BY parent_office_id NULLS LAST;
END
$function$