This code looks fine to me, other than missing the actual trigger statement is missing. Assuming table 1 is named apps: DROP TRIGGER OnApplicationsDelete ON apps; DROP FUNCTION ApplicationsDeleteFn(); CREATE FUNCTION ApplicationsDeleteFn() RETURNS OPAQUE AS ' BEGIN delete from ports where appName=OLD.appName; RETURN OLD; END; ' LANGUAGE 'plpgsql'; CREATE TRIGGER OnApplicationsDelete BEFORE DELETE ON apps FOR EACH ROW EXECUTE PROCEDURE ApplicationsDeleteFn(); But the question is, would it be better to use a foreign key? If you put a foreign key on ports.appName that REFERENCES apps.appName, you could define it as an ON DELETE CASCADE relationship. Meaning that deleting the value from the apps table would cascade that delete to the ports table. Hope this helps, Greg ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]