From: | "Tjibbe Rijpma" <tjibbe(at)hotmail(dot)com> |
---|---|
To: | "Tirant Lo Blanc" <tirantloblanc77(at)yahoo(dot)es>, <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Small function in PLPGSQL |
Date: | 2005-12-21 14:48:40 |
Message-ID: | BAY13-DAV782CF08412BE352398EE7DD310@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
CREATE FUNCTION insert_row (VARCHAR, VARCHAR) RETURNS INT AS '
DECLARE
id INT;
BEGIN;
id := nextval('seq');
INSERT INTO table VALUES (id, $1, $2);
RETURN id;
END
LANGUAGE plpqsql;
----- Original Message -----
From: Tirant Lo Blanc
To: pgsql-novice(at)postgresql(dot)org
Sent: Saturday, December 17, 2005 21:30
Subject: [NOVICE] Small function in PLPGSQL
Hello, I'm learning plpsql and have a question:
I would like to create a function that inserts a new record on my invoice table.
This table has an id (serial type).
I would like this function to return de id assigned to the new record.
any ideas?
Thanks, and excuse my poor English.
------------------------------------------------------------------------------
Correo Yahoo!
Comprueba qué es nuevo, aquí
http://correo.yahoo.es
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg | 2005-12-21 15:07:06 | Re: transfer database from Linux to Windows |
Previous Message | Anna Domachowska | 2005-12-21 10:01:38 | problem with nasty latin2 sorting |