pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed[HELP] Defining a function as a procedure
2+ messages / 2 participants
[nested] [flat]
* [HELP] Defining a function as a procedure
@ 2006-01-26 17:09 Daniel Caune <daniel.caune@ubisoft.com>
2006-01-26 18:02 ` Re: [HELP] Defining a function as a procedure Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Caune @ 2006-01-26 17:09 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [HELP] Defining a function as a procedure
2006-01-26 17:09 [HELP] Defining a function as a procedure Daniel Caune <daniel.caune@ubisoft.com>
@ 2006-01-26 18:02 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2006-01-26 18:02 UTC (permalink / raw)
To: Daniel Caune <daniel.caune@ubisoft.com>; +Cc: pgsql-sql
"Daniel Caune" <daniel.caune@ubisoft.com> writes:
> Is there a way to define a function as a procedure, I mean a function
> that returns nothing.
In recent versions you can say RETURNS VOID, which is a bit of a hack
but it gets the point across...
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-01-26 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-26 17:09 [HELP] Defining a function as a procedure Daniel Caune <daniel.caune@ubisoft.com>
2006-01-26 18:02 ` Tom Lane <tgl@sss.pgh.pa.us>
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