Обсуждение: oid in PL/pgSQL
Hi,
I need the row oid of an insert in an PL/pgSQL function.
For explanation: After an insert I call a PL/pgSQL function (by a trigger) and I like to insert into an other table the row oid of the first insert. But I don't know how to get the oid.
Thank you for helping,
Peter
I need the row oid of an insert in an PL/pgSQL function.
For explanation: After an insert I call a PL/pgSQL function (by a trigger) and I like to insert into an other table the row oid of the first insert. But I don't know how to get the oid.
Thank you for helping,
Peter
--
CREATE FUNCTION func1() RETURNS OPAQUE AS '
BEGIN
dummy := new.name;
dummy1 := new.oid;
INSERT INTO table VALUES (dummy,dummy1);
RETURN new;
END;'
language 'plpgsql';
--
CREATE TRIGGER test1 AFTER INSERT OR UPDATE OR DELETE
ON person for each row execute procedure pro1('name','oid');
--
begin;
insert into person values ('.........');
end;
=> ERROR: record new has no field oid
-- Peter Keller Tel: (+49) 089-2190-2594 Fax: (+49) 089-2190-2459 mailto:Peter.Keller@bvv.bayern.de .............................................................. Bezirksfinanzdirektion Muenchen - Vermessungsabteilung Alexandrastr. 3 80538 Muenchen Zimmer: 404 www: http://www.bayern.de/vermessung/ --