可能这是微不足道的,但我不确定为什么当我将关系设计导出为 ddl 时 Oracle 会创建额外的表。
CREATE TABLE WHY
(
Col1_ID INTEGER NOT NULL ,
Col2_ID INTEGER NOT NULL
) ;
ALTER TABLE WHY ADD CONSTRAINT WHY_PK PRIMARY KEY ( Col1_ID, Col2_ID ) ;
Oracle 添加了这个表
CREATE TABLE WHY_JN
(JN_OPERATION CHAR(3) NOT NULL
,JN_ORACLE_USER VARCHAR2(30) NOT NULL
,JN_DATETIME DATE NOT NULL
,JN_NOTES VARCHAR2(240)
,JN_APPLN VARCHAR2(35)
,JN_SESSION NUMBER(38)
,Col1_ID INTEGER NOT NULL
,Col2_ID INTEGER NOT NULL
);
和这个
CREATE OR REPLACE TRIGGER WHY_JNtrg
AFTER
INSERT OR
UPDATE OR
DELETE ON WHY for each row
Declare
rec WHY_JN%ROWTYPE;
blank WHY_JN%ROWTYPE;
BEGIN
rec := blank;
IF INSERTING OR UPDATING THEN
rec.Col1_ID := :NEW.Col1_ID;
rec.Col2_ID := :NEW.Col2_ID;
rec.JN_DATETIME := SYSDATE;
rec.JN_ORACLE_USER := SYS_CONTEXT ('USERENV', 'SESSION_USER');
rec.JN_APPLN := SYS_CONTEXT ('USERENV', 'MODULE');
rec.JN_SESSION := SYS_CONTEXT ('USERENV', 'SESSIONID');
IF INSERTING THEN
rec.JN_OPERATION := 'INS';
ELSIF UPDATING THEN
rec.JN_OPERATION := 'UPD';
END IF;
ELSIF DELETING THEN
rec.Col1_ID := :OLD.Col1_ID;
rec.Col2_ID := :OLD.Col2_ID;
rec.JN_DATETIME := SYSDATE;
rec.JN_ORACLE_USER := SYS_CONTEXT ('USERENV', 'SESSION_USER');
rec.JN_APPLN := SYS_CONTEXT ('USERENV', 'MODULE');
rec.JN_SESSION := SYS_CONTEXT ('USERENV', 'SESSIONID');
rec.JN_OPERATION := 'DEL';
END IF;
INSERT into WHY_JN VALUES rec;
END;
/
ddl 文件的顶部:
-- Generated by Oracle SQL Developer Data Modeler 4.1.3.901
-- at: 2016-03-28 19:37:37 EDT
-- site: Oracle Database 11g
-- type: Oracle Database 11g
文件底部
-- Oracle SQL Developer Data Modeler Summary Report:
--
-- CREATE TABLE 1
-- CREATE INDEX 0
-- ALTER TABLE 3
-- CREATE VIEW 0
-- ALTER VIEW 0
-- CREATE PACKAGE 0
-- CREATE PACKAGE BODY 0
-- CREATE PROCEDURE 0
-- CREATE FUNCTION 0
-- CREATE TRIGGER 3
-- ALTER TRIGGER 0
-- CREATE COLLECTION TYPE 0
-- CREATE STRUCTURED TYPE 0
-- CREATE STRUCTURED TYPE BODY 0
-- CREATE CLUSTER 0
-- CREATE CONTEXT 0
-- CREATE DATABASE 0
-- CREATE DIMENSION 0
-- CREATE DIRECTORY 0
-- CREATE DISK GROUP 0
-- CREATE ROLE 0
-- CREATE ROLLBACK SEGMENT 0
-- CREATE SEQUENCE 0
-- CREATE MATERIALIZED VIEW 0
-- CREATE SYNONYM 0
-- CREATE TABLESPACE 0
-- CREATE USER 0
--
-- DROP TABLESPACE 0
-- DROP DATABASE 0
--
-- REDACTION POLICY 0
--
-- ORDS DROP SCHEMA 0
-- ORDS ENABLE SCHEMA 0
-- ORDS ENABLE OBJECT 0
--
-- ERRORS 0
-- WARNINGS 0
如果有人能指出我的官方参考资料,我将不胜感激。