Answers for "on insert trigger postgresql"

SQL
8

example of trigger in postgresql

-- Trigger to update donatiom count in donor table whenever
-- A new donation is made by that person

CREATE or REPLACE FUNCTION increase_count()
RETURNS TRIGGER
AS
$$
BEGIN
	UPDATE donor SET dcount = dcount + 1 WHERE did = NEW.did;
END
$$
LANGUAGE plpgsql;



CREATE TRIGGER update_donation_count AFTER INSERT ON donation
FOR EACH ROW
EXECUTE PROCEDURE increase_count();
Posted by: Guest on May-19-2020
0

postgres trigger insert into another table

CREATE TRIGGER trig_copy
     AFTER INSERT ON table1
     FOR EACH ROW
     EXECUTE PROCEDURE function_copy();
Posted by: Guest on August-22-2020

Code answers related to "on insert trigger postgresql"

Code answers related to "SQL"

Browse Popular Code Answers by Language