From: | "Angva" <angvaw(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Loop plpgsql recordset |
Date: | 2007-01-26 22:46:59 |
Message-ID: | 1169851619.068177.289500@v33g2000cwv.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
This is how I loop through a record:
for rec in (select * from yourtable where somevar=3) loop
--output the record
raise notice '%', rec.somevar
end loop;
------
Mark
On Jan 25, 2:46 pm, fureszpe(dot)(dot)(dot)(at)srv(dot)hu ("Furesz Peter") wrote:
> Hello,
>
> How can I loop a PL/PgSQL recorset variable? The example:
>
> DECLARE
> v_tmp_regi RECORD;
> v_tmp RECORD;
> BEGIN
> SELECT * INTO v_tmp_regi FROM sulyozas_futamido sf WHERE
> sf.termekfajta_id=
> a_termekfajta_id AND sf.marka_id=a_marka_id;
>
> DELETE FROM sulyozas_futamido;
>
> FOR v_tmp IN v_tmp_regi LOOP
> --I would like to work here with the old recordset!
> END LOOP;
> ^^^^^^^^^^^^^^
> -- This is not working !!!
>
> END;
From | Date | Subject | |
---|---|---|---|
Next Message | Angva | 2007-01-26 22:49:42 | 8.2 planner and "like" |
Previous Message | Angva | 2007-01-26 22:39:48 | Re: Ayuda sobre Indices |