Insert Function

From: "David Durst" <ddurst(at)la-rubber(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Insert Function
Date: 2002-07-10 19:59:24
Message-ID: 1220.10.1.1.39.1026331164.squirrel@www.la-rubber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2002-07-10 20:10:06 Re: BETWEEN bug?
Previous Message Josh Berkus 2002-07-10 19:35:53 BETWEEN bug?