If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I'd like to create triggers (or procedure) that update automatically the value NAME in the tables TM and TL.

for example:
If I insert into TN a new COD_ID (A39) and a new NAME (AT38), when I insert a new ID_X in tble TM, I'd like
to have the value AT38 in NAME of TM, and when I insert a new record in table TL I'd like
to have the value AT38 in NAME of TL.
Also when I update NAME of TN.

I tried with these triggers:

CREATE OR REPLACE TRIGGER TN_PR_BEFORE_UPD
BEFORE UPDATE OF NAME ON TL
FOR EACH ROW
DECLARE
tmpVar NUMBER;
BEGIN

update TL set NAME=:new.NAME where TL.COD_id=:new.COD_id;

UPDATE TM SET NAME=:NEW.NAME WHERE ID_X=:NEW.COD_ID;

END TN_PR_BEFORE_UPD;

CREATE OR REPLACE TRIGGER TN_COD_ID
BEFORE UPDATE OF COD_ID ON TL
FOR EACH ROW
BEGIN
SELECT NAME INTO :NEW.NAME FROM TN WHERE TN.COD_ID=:NEW.COD_ID;
END TN_COD_ID;

CREATE OR REPLACE TRIGGER TL_pr
BEFORE UPDATE OF NAME ON TL
BEGIN
UPDATE TM SET NAME=:NEW.NAME WHERE ID_X=:NEW.ID_X AND :NEW.ID_X IS NOT NULL;
END TL_pr;

CREATE OR REPLACE TRIGGER TL_PR_BEFORE_INSERT
before INSERT ON TL
FOR EACH ROW
DECLARE
tmpVar varchar2(64);
BEGIN

SELECT NAME
into tmpVar
FROM TN
WHERE COD_ID=:NEW.COD_ID;

END TL_PR_BEFORE_INSERT;

when I update TN triggers run CORRECTLY but when I insert a new record in TM, TN, TL I don't see a new NAME.

You only need the trigger on the first table (where the user is inserting data.) Your other triggers are overwriting the :NEW data with the existing NULL data. Just delete the other triggers and you should be fine.