1
CREATE TABLE footable(id integer, sometext text);

CREATE OR REPLACE FUNCTION foofunction()
RETURNS VOID AS $$
DECLARE
id_parameter integer;
BEGIN
INSERT INTO footable(sometext) VALUES('footext') RETURNING id;
id_parameter:=id;
PERFORM call_foo_function(id_parameter);
END LANGUAGE plpgsql VOLATILE;

This code doesn't work.

How can i get returning id and set it to id_parameter variable so that use it in call_foo_function(id_parameter) as parameter.

Dmitry S
  • 4,990
  • 2
  • 24
  • 32
lowdegeneration
  • 359
  • 5
  • 13
  • 3
    `... RETURNING id INTO id_parameter;` [Executing a Query with a Single-row Result](http://www.postgresql.org/docs/9.5/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW) – Abelisto Mar 18 '16 at 17:56

0 Answers0