Answers for "postgresql for each"

SQL
4

for loop postgresql

FOR r IN SELECT * FROM foo
    WHERE fooid > 0
    LOOP
        -- can do some processing here
        RETURN NEXT r; -- return current row of SELECT
    END LOOP;
Posted by: Guest on November-24-2020
0

foreach postgres

do
$$
declare
	rec record;
begin
	for rec in select title, length 
			from film 
			where length > 50
			order by length
	loop
		raise notice '% (%)', rec.title, rec.length;	
	end loop;
end;
$$Code language: PostgreSQL SQL dialect and PL/pgSQL (pgsql)
Posted by: Guest on October-06-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language