X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 31234EFF8D for ; Fri, 6 Jun 2003 22:14:35 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 08250-05 for ; Fri, 6 Jun 2003 22:14:33 +0000 (GMT) Received: from web12906.mail.yahoo.com (web12906.mail.yahoo.com [216.136.174.73]) by svr1.postgresql.org (Postfix) with SMTP id 2A1E5EFF79 for ; Fri, 6 Jun 2003 22:14:33 +0000 (GMT) Message-ID: <20030606221435.44876.qmail@web12906.mail.yahoo.com> Received: from [200.38.247.126] by web12906.mail.yahoo.com via HTTP; Fri, 06 Jun 2003 17:14:35 CDT Date: Fri, 6 Jun 2003 17:14:35 -0500 (CDT) From: "=?iso-8859-1?q?Mr=20Weinbach,=20Larry?=" Subject: Using a RETURN NEXT To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200306/55 X-Sequence-Number: 13813 Hi all, I found this example from Postgres site create or replace function GetRows(text) returns setof record as ' declare r record; begin for r in EXECUTE ''select * from '' || $1 loop return next r; end loop; return; end ' language 'plpgsql'; I am trying to use the same idea but in this way .. CREATE OR REPLACE FUNCTION word_case() RETURNS setof RECORD AS' DECLARE reg record; BEGIN FOR reg IN SELECT message FROM rtable LOOP RETURN next reg; END LOOP; RETURN; END; ' LANGUAGE 'plpgsql'; But at execution time I am getting thi error : WARNING: Error occurred while executing PL/pgSQL function word_case WARNING: line 5 at return next ERROR: Set-valued function called in context that cannot accept a set I also tried using my own type defined but I got the same error. Any hint or idea will be appreciated ... Regards Larry _________________________________________________________ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com