Replication Issue [message #116911] |
Sat, 23 April 2005 03:38 |
sohailnawaz
Messages: 40 Registered: April 2005 Location: Saudi Arabia
|
Member |
|
|
Sir,
I want to replicate values in the table of another schama. Here is my code. This code is replicated the values successfully in the same schama of table. But i want to replicate values in another schama of table. any body can help me regarding that. Thanks in Advance. Here is my code.
CREATE OR REPLACE TRIGGER "REPLICATE_EMP" AFTER INSERT OR DELETE OR UPDATE OF EMPNO, ENAME,SALARY ON EMP REFERENCING NEW AS N OLD AS O FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO COPY_EMP (EMPNO,ENAME,SALARY)
VALUES (:N.EMPNO,:N.ENAME,:N.SALARY);
ELSIF UPDATING THEN
UPDATE COPY_EMP
SET EMPNO = :N.EMPNO,ENAME = :N.ENAME,SALARY = :N.SALARY
WHERE EMPNO = .EMPNO;
ELSIF DELETING THEN
DELETE FROM COPY_EMP
WHERE EMPNO = .EMPNO;
END IF;
END;
Regars,
Sohail Nawaz.
|
|
|
Re: Replication Issue [message #117090 is a reply to message #116911] |
Sun, 24 April 2005 19:59 |
|
Barbara Boehmer
Messages: 9100 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Preface the table names with the schema names.
CREATE OR REPLACE TRIGGER YOUR_SCHEMA.REPLICATE_EMP
AFTER INSERT OR DELETE OR UPDATE
OF EMPNO, ENAME, SALARY ON YOUR_SCHEMA.EMP
REFERENCING NEW AS N OLD AS O FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO OTHER_SCHEMA.COPY_EMP (EMPNO,ENAME,SALARY)
VALUES (:N.EMPNO, :N.ENAME, :N.SALARY);
ELSIF UPDATING THEN
UPDATE OTHER_SCHEMA.COPY_EMP
SET EMPNO = :N.EMPNO,
ENAME = :N.ENAME,
SALARY = :N.SALARY
WHERE EMPNO = :O.EMPNO;
ELSIF DELETING THEN
DELETE FROM OTHER_SCHEMA.COPY_EMP
WHERE EMPNO = :O.EMPNO;
END IF;
END;
/
|
|
|
|