pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Durst <ddurst@la-rubber.com>
To: pgsql-sql@postgresql.org
Subject: Insert Function
Date: Wed, 10 Jul 2002 12:59:24 -0700 (PDT)
Message-ID: <1220.10.1.1.39.1026331164.squirrel@www.la-rubber.com> (raw)

Is there anyway to create a insert function?
I am trying:
CREATE FUNCTION add_user(varchar(20),varchar(20),varchar(20),int4,int4)
RETURNS int4 AS 'INSERT INTO usr
(user_name,first_name,last_name,permission_set_id,customer_id) values
($1,$2,$3,$4,$5)' language 'sql';

and get:

ERROR:  function declared to return integer, but final statement is not a
SELECT
I thought that a insert would return a internal row #, but I am not sure
about this.

Thanks,
David Durst
MIS Manager
www.la-rubber.com





view thread (3+ messages)  latest in thread

Message-ID: <1220.10.1.1.39.1026331164.squirrel@www.la-rubber.com>
Permalink:  ../1220.10.1.1.39.1026331164.squirrel@www.la-rubber.com/
Also on:    postgresql.org/message-id/1220.10.1.1.39.1026331164.squirrel@www.la-rubber.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ddurst@la-rubber.com
  Subject: Re: Insert Function
  In-Reply-To: <1220.10.1.1.39.1026331164.squirrel@www.la-rubber.com>

* 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