you can try:
CREATE OR REPLACE FUNCTION add_something(text, text)
RETURNS integer AS
$BODY$
DECLARE
somevariable integer;
BEGIN
INSERT INTO sometable (id, foo, bar ) VALUES (DEFAULT, $1, $2 ) RETURNING id
INTO somevariable;
return somevariable;
END;$BODY$ LANGUAGE 'plpgsql' VOLATILE;
--
View this message in context: http://www.nabble.com/INSERT-with-RETURNING-clause-inside-SQL-function-tp20312197p25678362.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.