Re: PL/pgSQL question

From: "Milen A(dot) Radev" <milen(at)radev(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/pgSQL question
Date: 2008-02-14 13:50:13
Message-ID: fp1guu$6co$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sebastian Ritter написа:
> Hi all,
>
> I have a question regarding functions. How can I return zero rows from a
> function whose return type is a table row? I did the following test and it
> did not work as expected:
[...]

CREATE OR REPLACE FUNCTION foobar(boolean) RETURNS SETOF x AS $_$
DECLARE
res x%ROWTYPE;
BEGIN

if $1 THEN
RETURN NEXT res;
ELSE
RETURN;
END IF;
END;$_$

LANGUAGE plpgsql;

--
Milen A. Radev

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dean Gibson (DB Administrator) 2008-02-14 23:08:20 FUNCTIONs and CASTs
Previous Message Sebastian Ritter 2008-02-14 13:23:33 PL/pgSQL question