pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Caune <daniel.caune@ubisoft.com>
To: pgsql-sql@postgresql.org
Subject: [HELP] Defining a function as a procedure
Date: Thu, 26 Jan 2006 12:09:14 -0500
Message-ID: <1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org> (raw)

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

 

view thread (2+ messages)  latest in thread

Message-ID: <1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org>
Permalink:  ../1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org/
Also on:    postgresql.org/message-id/1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: daniel.caune@ubisoft.com
  Subject: Re: [HELP] Defining a function as a procedure
  In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org>
  References: <1E293D3FF63A3740B10AD5AAD88535D201663CC5@UBIMAIL1.ubisoft.org>

* 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