Deseo vincular 2 tablas, con algunos campos en común, y que los cambios (transacciones) que se realicen en la primera, se reflejen automáticamente en la 2a. Tabla.
1 Respuesta
Respuesta
1
1
Anónimo
Debes crear un CLUSTER que refleje los campos en común que tienen las dos tablas. A continuación te muestro un ejemplo en Oracle8i (espero que entiendas el ingles): CREATE CLUSTER personnel ( department_number NUMBER(2) ) SIZE 512 STORAGE (INITIAL 100K NEXT 50K); Adding Tables to a Cluster The following statements add the EMP and DEPT tables to the cluster: CREATE TABLE emp (empno NUMBER PRIMARY KEY, ename VARCHAR2(10) NOT NULL CHECK (ename = UPPER(ename)), job VARCHAR2(9), mgr NUMBER REFERENCES scott.emp(empno), hiredate DATE CHECK (hiredate < TO_DATE ('08-14-1998', 'MM-DD-YYYY')), sal NUMBER(10,2) CHECK (sal > 500), comm NUMBER(9,0) DEFAULT NULL, deptno NUMBER(2) NOT NULL ) CLUSTER personnel (deptno); CREATE TABLE dept (deptno NUMBER(2), dname VARCHAR2(9), loc VARCHAR2(9)) CLUSTER personnel (deptno); Cluster Key Example The following statement creates the cluster index on the cluster key of PERSONNEL: CREATE INDEX idx_personnel ON CLUSTER personnel; After creating the cluster index, you can insert rows into either the EMP or DEPT tables.