CREATE OR REPLACE TRIGGER TRAINING.TR_MIDAS_CLOSETT
AFTER UPDATE
ON TRAINING.TT_TROUBLETKT
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
BEGIN
--IF SUBPRODUCT <> PAYPHONE AND SUBPRODUCT <> PW-DID CIRCUIT AND (TT STATUS == CLOSED or TT STATUS == Cancelled)
IF :NEW.SUBPRODUCT <> 1 AND :NEW.SUBPRODUCT <> 2 AND (:NEW.STATUS = 1 OR :NEW.STATUS = 2) THEN
INSERT INTO INT_MIDAS VALUES ( GET_NEXTRECID,:NEW.SERVICENO,2,SYSDATE,NULL);
END IF;
END TR_MIDAS_CLOSETT;
/
CREATE TABLE TT_TROUBLETKT
(
TTREF VARCHAR2(20 BYTE) NOT NULL,
SVCID VARCHAR2(15 BYTE),
PEGCUSTID VARCHAR2(10 BYTE),
CUSTID VARCHAR2(144 BYTE),
BILLACCTID VARCHAR2(10 BYTE),
BILLACCTNO VARCHAR2(144 BYTE),
SERVICENO VARCHAR2(144 BYTE) NOT NULL,
SVCTYPECODE VARCHAR2(10 BYTE),
CUSTRPTNO VARCHAR2(20 BYTE) NOT NULL,
N1NO VARCHAR2(144 BYTE),
CUSTNAME VARCHAR2(60 BYTE),
PRODUCT NUMBER(38) NOT NULL,
SUBPRODUCT NUMBER(38) NOT NULL,
SVCTYPE NUMBER(38),
NOC VARCHAR2(20 BYTE) NOT NULL,
PRIORITY NUMBER(38) NOT NULL,
COF1 VARCHAR2(20 BYTE),
COF2 VARCHAR2(20 BYTE),
STATUS NUMBER(38) NOT NULL,
KIVCODE NUMBER(38),
INSTADDR VARCHAR2(500 BYTE),
POSTALCODE VARCHAR2(10 BYTE),
LINETYPE VARCHAR2(15 BYTE),
RENTALTARIFF VARCHAR2(20 BYTE),
APPTID VARCHAR2(20 BYTE),
CONTACTNO VARCHAR2(30 BYTE),
CONTACTNAME VARCHAR2(60 BYTE),
PENDINGAPPTIND CHAR(1 BYTE),
EXCHANGE VARCHAR2(10 BYTE),
MDFEXCHANGE VARCHAR2(10 BYTE),
LOCALCABLECODE VARCHAR2(10 BYTE),
MAINCABLECODE VARCHAR2(10 BYTE),
CABNO VARCHAR2(10 BYTE),
CAB2NO VARCHAR2(10 BYTE),
CABDSP VARCHAR2(10 BYTE),
CAB2DSP VARCHAR2(10 BYTE),
CABESP VARCHAR2(10 BYTE),
CAB2ESP VARCHAR2(10 BYTE),
CABADDR VARCHAR2(500 BYTE),
CAB2ADDR VARCHAR2(500 BYTE),
DISTRIBPOINT VARCHAR2(10 BYTE),
STRIPPAIR VARCHAR2(10 BYTE),
IADMAC VARCHAR2(10 BYTE),
LINKREFNO VARCHAR2(10 BYTE),
DRT120KHZ VARCHAR2(10 BYTE),
LOOPRESIST VARCHAR2(10 BYTE),
L1EXCHCODE VARCHAR2(10 BYTE),
L1NODEID VARCHAR2(10 BYTE),
L1SUBNODE VARCHAR2(10 BYTE),
L1TERMNO VARCHAR2(10 BYTE),
E1SUBNODE VARCHAR2(10 BYTE),
E1TERMNO VARCHAR2(10 BYTE),
EQUIPTYPE VARCHAR2(15 BYTE),
IPADDR VARCHAR2(20 BYTE),
MUXFRAME VARCHAR2(20 BYTE),
CIRCUITNO VARCHAR2(10 BYTE),
NODETYPE VARCHAR2(10 BYTE),
KEY VARCHAR2(10 BYTE),
KEY2 VARCHAR2(10 BYTE),
UPSTREAM VARCHAR2(10 BYTE),
DOWNSTREAM VARCHAR2(10 BYTE),
SWITCH VARCHAR2(10 BYTE),
EXCHBASE VARCHAR2(30 BYTE),
AREA VARCHAR2(10 BYTE),
AREAGROUP VARCHAR2(30 BYTE),
AREA2 VARCHAR2(10 BYTE),
XDIND CHAR(1 BYTE),
ADSLIND CHAR(1 BYTE),
LSIND CHAR(1 BYTE),
PNIND VARCHAR2(10 BYTE),
RPTFLTCNT NUMBER(38),
RPTADSLFLTCNT NUMBER(38),
PEGASUSAVAILABLE CHAR(1 BYTE) NOT NULL,
NASAVAILABLE CHAR(1 BYTE) NOT NULL,
AWISAVAILABLE CHAR(1 BYTE) NOT NULL,
NONPEGASUSIND CHAR(1 BYTE),
SEARCHTYPE VARCHAR2(30 BYTE),
CKCREF VARCHAR2(20 BYTE),
FAULTCLEARED DATE,
CLOSEDATETIME DATE,
SOURCE VARCHAR2(10 BYTE),
SOURCEREFID VARCHAR2(30 BYTE),
CALLINBOUND VARCHAR2(1000 BYTE),
CREATEUSERID VARCHAR2(10 BYTE) NOT NULL,
CREATEDATETIME DATE NOT NULL,
CHANGEUSERID VARCHAR2(10 BYTE),
CHANGEDATETIME DATE,
BLACKLISTIND CHAR(1 BYTE),
ISP NUMBER(38),
USERMODEM NUMBER(38),
MODEMSN VARCHAR2(60 BYTE),
INSTDATE DATE,
LASTTTREF VARCHAR2(20 BYTE),
RPTDELFLTCNT NUMBER(38),
INSTUNITNO VARCHAR2(30 BYTE),
INSTBLKNO VARCHAR2(10 BYTE),
INSTSTNM VARCHAR2(60 BYTE),
INSTBLDGNM VARCHAR2(60 BYTE),
INSTDEVNM VARCHAR2(30 BYTE),
INSTCOUNTRY VARCHAR2(10 BYTE),
CARDNO NUMBER(38),
NOC2 VARCHAR2(20 BYTE),
ADSLNODEID VARCHAR2(10 BYTE)
)
TABLESPACE SYSTEM
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE INDEX I_ROUBLETKT ON TT_TROUBLETKT
(CKCREF)
LOGGING
TABLESPACE SYSTEM
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
NOPARALLEL;
CREATE UNIQUE INDEX TT_TROUBLETKT_PK ON TT_TROUBLETKT
(TTREF)
LOGGING
TABLESPACE SYSTEM
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
NOPARALLEL;
CREATE OR REPLACE TRIGGER TR_MIDAS_CREATETT
AFTER INSERT
ON TT_TROUBLETKT REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
BEGIN
--IF SUBPRODUCT <> PHONENET AND SUBPRODUCT <> PW-DID CIRCUIT AND TT STATUS == OPEN
IF :NEW.SUBPRODUCT <> 1 AND :NEW.SUBPRODUCT <> 2 AND :NEW.STATUS = 1 THEN
INSERT INTO INT_MIDAS VALUES ( GET_NEXTRECID,:NEW.SERVICENO,1,SYSDATE,NULL);
END IF;
END ;
/
SHOW ERRORS;
CREATE OR REPLACE TRIGGER TR_MIDAS_CLOSETT
AFTER UPDATE
ON TT_TROUBLETKT
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
BEGIN
--IF SUBPRODUCT <> PAYPHONE AND SUBPRODUCT <> PW-DID CIRCUIT AND (TT STATUS == CLOSED or TT STATUS == Cancelled)
IF :NEW.SUBPRODUCT <> 1 AND :NEW.SUBPRODUCT <> 2 AND (:NEW.STATUS = 1 OR :NEW.STATUS = 2) THEN
INSERT INTO INT_MIDAS VALUES ( GET_NEXTRECID,:NEW.SERVICENO,2,SYSDATE,NULL);
END IF;
END TR_MIDAS_CLOSETT;
/
SHOW ERRORS;
CREATE SYNONYM STARLIGHT.TT_TROUBLETKT FOR TT_TROUBLETKT;
ALTER TABLE TT_TROUBLETKT ADD (
CONSTRAINT TT_TROUBLETKT_PK
PRIMARY KEY
(TTREF)
USING INDEX
TABLESPACE SYSTEM
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
));
ALTER TABLE TT_TROUBLETKT ADD (
CONSTRAINT TT_TROUBLETKT
FOREIGN KEY (CKCREF)
REFERENCES TT_CKC (CKCREF));