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;
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;
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)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us