pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hélder M. Vieira <hmv@mail.telepac.pt>
To: pgsql-sql@postgresql.org
Subject: Re: Looping recordset
Date: Fri, 26 Jan 2007 00:56:19 -0000
Message-ID: <004401c740e4$d2213020$6200a8c0@hmv02> (raw)
References: <002901c740b9$56fff190$6500a8c0@bixerverintel>


>    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 !!!


I'd say v_tmp_regi is a record variable, it is supposed to hold one record, 
not a set of records.
Depending on the purpose, I'd probably use a temporary table to hold the 
selected rows or, perhaps, use the SELECT in the FOR..LOOP and subsequently 
perform the DELETE.


Hélder M. Vieira 




view thread (2+ messages)

Message-ID: <004401c740e4$d2213020$6200a8c0@hmv02>
Permalink:  ../004401c740e4$d2213020$6200a8c0@hmv02/
Also on:    postgresql.org/message-id/004401c740e4$d2213020$6200a8c0@hmv02

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: hmv@mail.telepac.pt
  Subject: Re: Looping recordset
  In-Reply-To: <004401c740e4$d2213020$6200a8c0@hmv02>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox