From: Tom Lane <tgl@sss.pgh.pa.us>
To: mmarencibia@yahoo.es
Cc: pgsql-novice@postgresql.org
Subject: Re: FOR-IN-EXECUTE, why fail?
Date: Mon, 19 Jul 2004 00:23:21 -0400
Message-ID: <8713.1090211001@sss.pgh.pa.us> (raw)
In-Reply-To: <e0e689c2.0407140713.3e898cc8@posting.google.com>
References: <e0e689c2.0407140713.3e898cc8@posting.google.com>
mmarencibia@yahoo.es (Marcos Medina) writes:
> I wrote the following:
> CREATE OR REPLACE FUNCTION escritorio.seq_valor_actual( text)
> DECLARE
> ...
> actual integer;
> BEGIN
> ...
> FOR actual IN EXECUTE v_query LOOP
The loop variable has to be a record or row variable, not an integer.
FWIW, 7.5 will give a better error message for this common mistake.
In CVS tip I get
ERROR: loop variable of loop over rows must be a record or row variable at or near "LOOP" at character 416
LINE 14: FOR actual IN EXECUTE v_query LOOP
^
regards, tom lane
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: tgl@sss.pgh.pa.us, mmarencibia@yahoo.es, pgsql-novice@postgresql.org
Subject: Re: FOR-IN-EXECUTE, why fail?
In-Reply-To: <8713.1090211001@sss.pgh.pa.us>
* 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