PostgreSQL - PL/pgSQL Fundamentals
You want to sum all elements of an integer array
nums using FOREACH. Which code correctly does this?DECLARE
nums integer[] := ARRAY[5, 10, 15];
total integer := 0;
BEGIN
FOREACH n IN ARRAY nums LOOP
-- What goes here? --
END LOOP;
RAISE NOTICE '%', total;
END;