Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgres trigger insert into another table

CREATE OR REPLACE FUNCTION function_copy() RETURNS TRIGGER AS
$BODY$
BEGIN
    INSERT INTO
        table2(id,name)
        VALUES(new.id,new.name);

           RETURN new;
END;
$BODY$
language plpgsql;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #postgres #trigger #insert #table
ADD COMMENT
Topic
Name
6+8 =