[HELP] Defining a function as a procedure

From: "Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: [HELP] Defining a function as a procedure
Date: 2006-01-26 17:09:14
Message-ID: 1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Is there a way to define a function as a procedure, I mean a function
that returns nothing.

CREATE OR REPLACE FUNCTION foo(<in-parameters>)

AS $$

BEGIN

<update-some-tables>

END;

$$ LANGUAGE 'plpgsql';

Actually, PostgreSQL complains as a "function result type must be
specified". I can patch my function so that it compiles but that won't
be really nice:

CREATE OR REPLACE FUNCTION foo(<in-parameters>)

RETURNS int

AS $$

BEGIN

<update-some-tables>

RETURN 1;

END;

$$ LANGUAGE 'plpgsql';

Is there any other prettier way to do that?

Thanks,

--

Daniel

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message J 2006-01-26 17:13:33 Re: Query optimization with X Y JOIN
Previous Message Peter Eisentraut 2006-01-26 16:59:30 Re: filtering after join