Home » Server Options » Replication » Replication Issue
Replication Issue [message #116911] Sat, 23 April 2005 03:38 Go to next message
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 = Surprised.EMPNO;

ELSIF DELETING THEN
DELETE FROM COPY_EMP
WHERE EMPNO = Surprised.EMPNO;

END IF;
END;

Regars,
Sohail Nawaz.
Re: Replication Issue [message #117090 is a reply to message #116911] Sun, 24 April 2005 19:59 Go to previous messageGo to next message
Barbara Boehmer
Messages: 7995
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;
/

Re: Replication Issue [message #122696 is a reply to message #117090] Wed, 08 June 2005 01:20 Go to previous message
girish.rohini
Messages: 744
Registered: April 2005
Location: Delhi (India)
Senior Member
or else create an aliase for this referenced table in ur current schema and use that alias in the trigger.
Previous Topic: Advantages and disadvantages to Multi-Master versus Master-Standby
Next Topic: Materialized View with ORDIMAGE
Goto Forum:
  


Current Time: Thu Oct 23 15:14:30 CDT 2014

Total time taken to generate the page: 0.10868 seconds