I have a function which I need amending to take in and use two additional parameters.
CREATE OR REPLACE FUNCTION boundaries.usp_drivingrange_stz(source integer, drivetime integer)
RETURNS geometry
LANGUAGE plpgsql
AS $function$
DECLARE
retRange geometry:=null;
BEGIN
SELECT st_multi(st_buffer(st_collect(geom_way),.00008))
into retRange
FROM "UKRoads".node as node
JOIN
(SELECT * FROM pgr_drivingDistance('
SELECT [login to view URL],
[login to view URL],
[login to view URL],
h.cost_m + COALESCE(a.add_cost_m, 0) + COALESCE(b.add_cost_m, 0)::real AS cost,
h.reverse_cost_m + COALESCE(a.add_cost_m, 0) + COALESCE(b.add_cost_m, 0)::real AS reverse_cost
FROM hh_2po_4pgr h
LEFT JOIN (select id, add_cost_m from additional_costs_a where delay = 10) as a ON [login to view URL] = [login to view URL]
LEFT JOIN (select id, add_cost_m from additional_costs_b where delay = 5) as b ON [login to view URL] = [login to view URL]',
source,
drivetime,
false)) AS dd ON [login to view URL] = [login to view URL];
RETURN retRange;
END;
$function$
;
I want the 10 and the 5 used in the two joins below to be taken from parameters to the function.
LEFT JOIN (select id, add_cost_m from additional_costs_a where delay = 10) as a ON [login to view URL] = [login to view URL]
LEFT JOIN (select id, add_cost_m from additional_costs_b where delay = 5) as b ON [login to view URL] = [login to view URL]',