Re: RE : Record unassigned yet

From: Richard Huxton <dev(at)archonet(dot)com>
To: Johann Robette <jrobette(at)onyme(dot)com>
Cc: 'Russell Smith' <mr-russ(at)pws(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RE : Record unassigned yet
Date: 2004-10-01 11:45:54
Message-ID: 415D4372.8090303@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Johann Robette wrote:
> Oh sorry about that!
> No, I was alright in the syntax. Both are defined as current.
> I can't find where the problem lies...

The following works fine for me.

=== BEGIN test ===
DROP TABLE employees;

CREATE TABLE employees (id integer, name text);
COPY employees FROM stdin;
1 Aaron Aardvark
2 Betty Bee
3 Carl Cat
\.

CREATE OR REPLACE FUNCTION emp_test_fn() RETURNS boolean AS '
DECLARE
current RECORD;
Tmp integer;
BEGIN
FOR current IN SELECT * FROM employees LOOP
Tmp := current.id;
RAISE NOTICE ''tmp = %'', Tmp;
END LOOP;
RETURN true;
END
'
LANGUAGE 'plpgsql';

SELECT emp_test_fn();
=== END test ===

PS - please reply to the -general list not -hackers.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2004-10-01 13:09:40 Re: CREATE INDEX speeds up query on 31 row table ...
Previous Message Johann Robette 2004-10-01 11:28:33 RE : Record unassigned yet

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2004-10-01 14:47:05 Re: Record unassigned yet
Previous Message Johann Robette 2004-10-01 11:28:33 RE : Record unassigned yet