plpgsql assigning RECORD := RECORD

From: bsides2(at)hotmail(dot)com (MK)
To: pgsql-general(at)postgresql(dot)org
Subject: plpgsql assigning RECORD := RECORD
Date: 2004-09-15 08:29:45
Message-ID: 3eb0886f.0409150029.321cbc1e@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have a question regarding the RECORD type in plpgsql functions.

How do I assign a RECORD variable to another RECORD variable?

For example,

DECLARE
rs1 RECORD;
rs2 RECORD;
BEGIN

FOR rs1 IN SELECT * FROM mytable LOOP

rs2 := rs1; --IS THIS POSSIBLE!?
END LOOP;
END;

When executing my function I receive 'syntax error at or near "rs2"'.
So, obviously my syntax is not correct. Is there another way to
perform this?

In my loop I need to have access to the PREVIOUS record. There are A
LOT of fields being selected so storing each in its own variable is
not a desirable solution.

Any ides?

Thanks in advance

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincent.Desloges 2004-09-15 09:14:29 support on postgres
Previous Message Marcel Boscher 2004-09-15 08:14:53 Tsearch2 adding additional dictionaries