CREATE TABLE "EMAIL_IN_T"
( "EMAIL_IN_ID" NUMBER,
"IMEMBER_SK" NUMBER,
"STITLE" VARCHAR2(20),
"SNATIVE_NM" VARCHAR2(40),
"SEMAILADDRESS" VARCHAR2(40),
"CREATED_ON" DATE,
"CREATED_BY" VARCHAR2(30),
"STELPERSONAL" VARCHAR2(15),
CONSTRAINT "EMAIL_IN_PK" PRIMARY KEY ("EMAIL_IN_ID") ENABLE
) ;
CREATE SEQUENCE "EMAIL_IN_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 22090 CACHE 20 NOORDER NOCYCLE ;
CREATE OR REPLACE TRIGGER "EMAIL_IN_T_TRIGGER"
BEFORE
insert or update on "EMAIL_IN_T"
for each row
DECLARE
SAVE_SEQ number;
begin
IF INSERTING THEN
:New.CREATED_ON := SYSDATE;
:New.CREATED_BY := V('APP_USER');
SELECT EMAIL_IN_SEQ.nextval INTO SAVE_SEQ FROM dual;
:new.EMAIL_IN_ID := SAVE_SEQ;
ELSIF UPDATING THEN
:New.CREATED_ON := SYSDATE;
:New.CREATED_BY := V('APP_USER');
END IF;
end;
/
*******************************
CREATE TABLE "EMAIL_OUT_T"
( "EMAIL_OUT_ID" NUMBER,
"IMEMBER_SK" NUMBER,
"STITLE" VARCHAR2(20),
"SNATIVE_NM" VARCHAR2(40),
"SEMAILADDRESS" VARCHAR2(40),
"HEADER" VARCHAR2(40),
"CREATED_ON" DATE,
"CREATED_BY" VARCHAR2(30),
"STELPERSONAL" VARCHAR2(15),
CONSTRAINT "EMAIL_OUT_PK" PRIMARY KEY ("EMAIL_OUT_ID") ENABLE
) ;
CREATE SEQUENCE "EMAIL_OUT_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 22150 CACHE 20 NOORDER NOCYCLE ;
CREATE OR REPLACE TRIGGER "EMAIL_OUT_T_TRIGGER"
BEFORE
insert or update on "EMAIL_OUT_T"
for each row
DECLARE
SAVE_SEQ number;
begin
IF INSERTING THEN
:New.CREATED_ON := SYSDATE;
:New.CREATED_BY := V('APP_USER');
SELECT EMAIL_OUT_SEQ.nextval INTO SAVE_SEQ FROM dual;
:new.EMAIL_OUT_ID := SAVE_SEQ;
ELSIF UPDATING THEN
:New.CREATED_ON := SYSDATE;
:New.CREATED_BY := V('APP_USER');
END IF;
end;
*******************************************
CREATE TABLE "EMAIL_CONTENT_T"
( "EMAIL_CONTENT_ID" NUMBER,
"EMAIL_SENDER" VARCHAR2(40),
"HEADER" VARCHAR2(40),
"EMAIL_CONTENT" VARCHAR2(500),
"CREATED_ON" DATE,
"CREATED_BY" VARCHAR2(30),
CONSTRAINT "EMAIL_CONTENT_PK" PRIMARY KEY ("EMAIL_CONTENT_ID") ENABLE
) ;
CREATE OR REPLACE TRIGGER "EMAIL_CONTENT_T_TRIGGER"
BEFORE
insert or update on "EMAIL_CONTENT_T"
for each row
DECLARE
SAVE_SEQ number;
begin
IF INSERTING THEN
:New.CREATED_ON := SYSDATE;
:New.CREATED_BY := V('APP_USER');
-- SELECT EMAIL_CONTENT_SEQ.nextval INTO SAVE_SEQ FROM dual;
-- :new.EMAIL_CONTENT_ID := SAVE_SEQ;
ELSIF UPDATING THEN
:New.CREATED_ON := SYSDATE;
:New.CREATED_BY := V('APP_USER');
END IF;
end;
/
********************************************