hát ez bizony több sebből vérzik.
ehhez nem kell plpgsql (nem plgsql) elég a sima sql
akkor viszont nem kell declare, begin, end sem.
a plpgsql -hez viszont kell return
de sql -el:
CREATE OR REPLACE FUNCTION public.proba(
cost double precision,
meta_steep double precision,
meta_curb_height double precision,
max_steep_up double precision,
max_steep_down double precision,
max_curb_up double precision,
meta_width double precision,
length double precision,
max_curb_down double precision)
RETURNS double precision AS
$BODY$select CASE
WHEN meta_steep > max_steep_up then (length*10000.0)
WHEN meta_steep < max_steep_down then (length*10000.0)
WHEN meta_curb_height > max_curb_up then (length*10000.0)
WHEN meta_curb_height < max_curb_down then (length*10000.0)
WHEN -meta_steep > max_steep_up then (length*10000.0)
WHEN -meta_steep < max_steep_down then (length*10000.0)
WHEN -meta_curb_height > max_curb_up then (length*10000.0)
WHEN -meta_curb_height < max_steep_down then (length*10000.0)
ELSE cost
END$BODY$
LANGUAGE sql VOLATILE;