CREATE OR REPLACE TRIGGER "MEMBERS_INSERT" BEFORE INSERT ON T_MEMBERS
FOR EACH ROW
DECLARE
vMemid VARCHAR2(20);
BEGIN
SELECT ID into vMemid
FROM A.T_MEMBERS
WHERE perid = :new.perid;
if vMemid is not null then
:new.memid := vMemid;
end if;
END;