

--
--    Licensed Materials - Property of IBM
--    
--    BI and PM: JSM
--    
--    (c) Copyright IBM Corp. 2003, 2010.
--    
--    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
--    


-------------------------------------------------------------------------------
--	NC3_UPDATE_ORA.SQL			*	DO NOT EDIT	 *			Data Store Version: 3 		 
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$100-- backup create begin
-------------------------------------------------------------------------------

 CREATE TABLE X_DATAMAPPING(
    PK_DM_ID                      INTEGER NOT NULL,
    NAME                          VARCHAR2(255),
    DESCRIPTION                   VARCHAR2(1000),
    SQL_STRING                    CLOB,
    FK_DS_ID                      INTEGER,
    LASTMOD_BY                    CHAR(40),
    LASTMOD_TIME                  DATE DEFAULT sysdate NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    FK_PPDS_ID                    INTEGER,
    FK_COGNOSDS_ID                INTEGER,
    URL                           VARCHAR2(2024),
    NIC                           VARCHAR2(2024)
);

CREATE TABLE XC_SCHEDULE(
   PK_SCHEDULE_ID                INTEGER NOT NULL,
   NAME                          VARCHAR2(255),
   DESCRIPTION                   VARCHAR2(1000),
   LASTMOD_BY                    CHAR(40),
   LASTMOD_TIME                  DATE DEFAULT sysdate NOT NULL,
   MODCOUNT                      INTEGER DEFAULT (-1),
   SCHEDULE_TYPE                 CHAR(6),
   EXECUTE_FIRST                 VARCHAR2(100),
   END_AT                        VARCHAR2(100),
   TIMEZONE                      VARCHAR2(100),
   START_DATE                    NUMBER,
   END_DATE                      NUMBER,
   REPEAT_FOREVER                INTEGER,
   ACTIVE                        INTEGER,
   VALID_SCHEDULE                INTEGER,
   USE_DAY_NUMBER                INTEGER,
   START_TIME_STRING             VARCHAR2(50),
   START_DATE_STRING             VARCHAR2(50),
   END_DATE_STRING               VARCHAR2(50),
   DAY_OF_MONTH                  INTEGER,
   DAY_OF_WEEK                   INTEGER,
   DAY_OF_WEEK_IN_MONTH          INTEGER,
   MONTH_OF_YEAR                 INTEGER,
   REPEAT_INTERVAL               INTEGER,
   ESCALATION_SCHEDULE           INTEGER,
   DAYS_OF_WEEK                  INTEGER,
   FIXED_INTERVAL_TYPE           INTEGER,
   FIXED_INTERVAL_IN_MILLIS      NUMBER(10)
);

CREATE TABLE X_NEWSITEMS_NCOBJECTS(
   FK_NCID                       INTEGER NOT NULL,
   NID                           CHAR(32) NOT NULL,
   VID                           CHAR(32),
   TYPE                          SMALLINT
);

-------------------------------------------------------------------------------
--$110-- backup inserts begin
-------------------------------------------------------------------------------

INSERT INTO X_DATAMAPPING (PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,
LASTMOD_BY,LASTMOD_TIME,MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL ,NIC)
SELECT PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,
MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL,NIC FROM NC_DATAMAPPING;

INSERT INTO XC_SCHEDULE
(PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,SCHEDULE_TYPE,
EXECUTE_FIRST,END_AT,TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,VALID_SCHEDULE,
USE_DAY_NUMBER,START_TIME_STRING,START_DATE_STRING,END_DATE_STRING,DAY_OF_MONTH,
DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,MONTH_OF_YEAR,REPEAT_INTERVAL,ESCALATION_SCHEDULE,
DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,FIXED_INTERVAL_IN_MILLIS)
SELECT 
PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,SCHEDULE_TYPE,
EXECUTE_FIRST,END_AT,TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,VALID_SCHEDULE,
USE_DAY_NUMBER,START_TIME_STRING,START_DATE_STRING,END_DATE_STRING,DAY_OF_MONTH,
DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,MONTH_OF_YEAR,REPEAT_INTERVAL,ESCALATION_SCHEDULE,
DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,FIXED_INTERVAL_IN_MILLIS 
 FROM NC_SCHEDULE;
 
INSERT INTO X_NEWSITEMS_NCOBJECTS (FK_NCID,NID,VID,TYPE) 
	SELECT FK_NCID,NID,VID,TYPE FROM R_NEWSITEMS_NCOBJECTS;

-------------------------------------------------------------------------------
--$120-- foreign keys drop begin
-------------------------------------------------------------------------------

ALTER TABLE NC_DATAMAPPING
   DROP CONSTRAINT F9N_DATAMAPPING;

ALTER TABLE NC_DATAMAPPING
   DROP CONSTRAINT F5N_DATAMAPPING;

ALTER TABLE R_TASKSCHEDULE_SCHEDULE 
	DROP CONSTRAINT F2R_TASKSCHEDULE_S;

-------------------------------------------------------------------------------
--$130-- views drop begin
-------------------------------------------------------------------------------

DROP VIEW V_BIE_COMPLETE;

DROP VIEW V_BIE_TOPIC;

DROP VIEW V_NC_TASK_LINK;

-------------------------------------------------------------------------------
--$140-- tables drop begin
-------------------------------------------------------------------------------

DROP TABLE NC_DATAMAPPING;

DROP TABLE NC_SCHEDULE;

DROP TABLE R_NEWSITEMS_NCOBJECTS;

-------------------------------------------------------------------------------
--$200-- recreate tables begin
-------------------------------------------------------------------------------

CREATE TABLE NC_ACCMAN_TEMP_STORE(
   TMP_ID                        INTEGER NOT NULL,
   ACCMAN_UID                    NUMBER(18) NOT NULL,
   USER_NAME                     VARCHAR2(100),
   EMAIL_ADDRESS                 VARCHAR2(100),
   DESCRIPTION                   VARCHAR2(2000)
);

CREATE TABLE NC_DATAMAPPING(
   PK_DM_ID                      INTEGER NOT NULL,
   NAME                          VARCHAR2(440),
   DESCRIPTION                   VARCHAR2(1000),
   SQL_STRING                    CLOB,
   FK_DS_ID                      INTEGER,
   LASTMOD_BY                    CHAR(40),
   LASTMOD_TIME                  DATE DEFAULT sysdate NOT NULL,
   MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
   FK_PPDS_ID                    INTEGER,
   FK_COGNOSDS_ID                INTEGER,
   URL                           VARCHAR2(2048),
   NIC                           CLOB
);

CREATE TABLE NC_RUNTIME_TICKET(
   TICKET_ID                     VARCHAR2(32) NOT NULL
);

CREATE TABLE NC_SCHEDULE(
   PK_SCHEDULE_ID                INTEGER NOT NULL,
   NAME                          VARCHAR2(255),
   DESCRIPTION                   VARCHAR2(1000),
   LASTMOD_BY                    CHAR(40),
   LASTMOD_TIME                  DATE DEFAULT sysdate NOT NULL,
   MODCOUNT                      INTEGER DEFAULT (-1),
   SCHEDULE_TYPE                 CHAR(6),
   TIMEZONE                      VARCHAR2(100),
   START_DATE                    NUMBER,
   END_DATE                      NUMBER,
   REPEAT_FOREVER                INTEGER,
   ACTIVE                        INTEGER,
   VALID_SCHEDULE                INTEGER,
   USE_DAY_NUMBER                INTEGER,
   DAY_OF_MONTH                  INTEGER,
   DAY_OF_WEEK                   INTEGER,
   DAY_OF_WEEK_IN_MONTH          INTEGER,
   MONTH_OF_YEAR                 INTEGER,
   REPEAT_INTERVAL               INTEGER,
   DAYS_OF_WEEK                  INTEGER,
   FIXED_INTERVAL_TYPE           INTEGER,
   FIXED_INTERVAL_IN_MILLIS      NUMBER(10)
);

CREATE TABLE R_NEWSITEMS_NCOBJECTS(
	NID             	           	CHAR(32) NOT NULL, 
   FK_NCID                       INTEGER NOT NULL,
   TYPE									SMALLINT
);

CREATE TABLE R_NEWSVIEWS_NCOBJECTS(
	VID 									CHAR(32) NOT NULL,
	NID									CHAR(32) NOT NULL,
	FK_NCID								INTEGER NOT NULL
);

-------------------------------------------------------------------------------
--$201-- indices create begin
-------------------------------------------------------------------------------

CREATE INDEX I1N_AGGREGATE_RULE ON NC_AGGREGATE_RULE_TREE (
   FK_PARENT_ID);

CREATE INDEX I1N_BIETOPIC ON NC_BIETOPIC (
   FK_DMT_ID);

CREATE INDEX I2N_BIETOPIC ON NC_BIETOPIC (
   FK_BIE_ID);

CREATE INDEX I1N_DATAMAPPING ON NC_DATAMAPPING (
   FK_PPDS_ID);

CREATE INDEX I2N_DATAMAPPING ON NC_DATAMAPPING (
   FK_DS_ID);

CREATE INDEX I1N_DYN_DELIVERY_I ON NC_DYN_DELIVERY_INFO_STRUCT (
   FK_DYNAMIC_RECIPIENT_STRUCT);

CREATE INDEX I7N_EXECUTABLE ON NC_EXECUTABLE (
   FK_TASK_ID);

CREATE INDEX I1N_MESSAGELINE ON NC_MESSAGELINE (
   FK_MESSAGESTRUCT_ID);

CREATE INDEX I1N_MESSAGESTRUCT ON NC_MESSAGESTRUCT (
   FK_DYNREC_ID);

CREATE INDEX I1N_MESSAGE_ATTACH ON NC_MESSAGE_ATTACHMENT (
   FK_MESSAGE_ID);

CREATE INDEX I1N_MSGDUPLICATION ON NC_MSGDUPLICATION_STORE (
   FK_MESSAGESTRUCT_ID);

CREATE INDEX I1N_ION_TEMP_STORE ON NC_MSGDUPLICATION_TEMP_STORE (
   SESSION_ID);

CREATE INDEX I1R_NEWSITEMS_NCOB ON R_NEWSITEMS_NCOBJECTS (
   TYPE);

CREATE INDEX I2R_NEWSITEMS_NCOB ON R_NEWSITEMS_NCOBJECTS (
   FK_NCID);

CREATE INDEX I1R_NEWSVIEWS_NCOB ON R_NEWSVIEWS_NCOBJECTS (
   FK_NCID);

CREATE INDEX I2R_NEWSVIEWS_NCOB ON R_NEWSVIEWS_NCOBJECTS (
   NID);

CREATE INDEX I1N_RULE ON NC_RULE (
   FK_BIE_ID);

CREATE INDEX I1N_TASKSCHEDULE ON NC_TASKSCHEDULE (
   FK_TASK_ID);

CREATE INDEX I7R_DS_MACHINE_DSP ON R_DS_MACHINE_DSPOOL (
   FK_MACHINE_ID);

CREATE INDEX I2R_DS_MACHINE_DSP ON R_DS_MACHINE_DSPOOL (
   FK_DSPOOL_ID);

CREATE INDEX I1R_MESSAGESTRUCT_ ON R_MESSAGESTRUCT_TASK (
   FK_MESSAGESTRUCT_ID);

CREATE INDEX I1R_MSGSTRUCT_AVOI ON R_MSGSTRUCT_AVOIDTOPICS (
   FK_MS_ID);

CREATE INDEX I1R_MSGSTRUCT_RECI ON R_MSGSTRUCT_RECIPIENT_DELIVINF (
   FK_MESSAGESTRUCT_ID);

CREATE INDEX I1R_RECIPIENT_ACCM ON R_RECIPIENT_ACCMANUSERID (
   F_RECIPIENTID);

CREATE INDEX I1R_RULE_PARAMETER ON R_RULE_PARAMETER (
   FK_TASK_ID);

CREATE INDEX I1R_TASKSCHEDULE_S ON R_TASKSCHEDULE_SCHEDULE (
   FK_TASKSCHEDULE_ID);

-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------

ALTER TABLE NC_ACCMAN_TEMP_STORE
   ADD (CONSTRAINT PN_ACCMAN_TEMP_STO PRIMARY KEY (ACCMAN_UID,TMP_ID));

ALTER TABLE NC_DATAMAPPING
   ADD (CONSTRAINT PN_DATAMAPPING PRIMARY KEY (PK_DM_ID));

ALTER TABLE NC_SCHEDULE
   ADD (CONSTRAINT PN_SCHEDULE PRIMARY KEY (PK_SCHEDULE_ID));
   
ALTER TABLE R_NEWSITEMS_NCOBJECTS
   ADD (CONSTRAINT PR_NEWSITEMS_NCOBJ PRIMARY KEY (NID));

ALTER TABLE R_NEWSVIEWS_NCOBJECTS
   ADD (CONSTRAINT PR_NEWSVIEWS_NCOBJ PRIMARY KEY (VID));

-------------------------------------------------------------------------------
--$203-- alter tables begin
-------------------------------------------------------------------------------

ALTER TABLE NC_MESSAGESTRUCT MODIFY(SUBJECT VARCHAR2(210));

ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
   ADD (DATE_ADDED NUMBER(18));

-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------

CREATE VIEW V_ACCMANUSER
AS SELECT 
	NC_ACCMAN_TEMP_STORE.TMP_ID, 
   NC_ACCMAN_TEMP_STORE.ACCMAN_UID, 
   NC_ACCMAN_TEMP_STORE.USER_NAME, 
   NC_ACCMAN_TEMP_STORE.DESCRIPTION, 
   R_RECIPIENT_ACCMANUSERID.F_RECIPIENTID, 
   NC_ACCMAN_TEMP_STORE.EMAIL_ADDRESS
FROM
	NC_ACCMAN_TEMP_STORE,
	R_RECIPIENT_ACCMANUSERID 
WHERE 
   NC_ACCMAN_TEMP_STORE.ACCMAN_UID = R_RECIPIENT_ACCMANUSERID.ACCMAN_UID(+);
   
   
   

CREATE VIEW V_NC_TASK_LINK AS SELECT
    NC_TASK.PK_TASK_ID, NC_TASK.NAME,
    NC_TASK.DESCRIPTION,
    NC_OBJECTCATALOGUE.SUBTYPE AS AGENT_SUBTYPE,
    NC_OBJECTCATALOGUE.TYPE AS AGENT_TYPE,
    NC_TASK.FK_BIE_ID,
    NC_TASK.THRESHOLD, NC_TASK.WEIGHTS,
    NC_TASK.TASK_TYPE, NC_TASK.DATEFORMAT,
    NC_TASK.DETECTION_OPTION,
    NC_TASK.LASTMOD_TIME, NC_TASK.MODCOUNT,
    NC_TASK.LASTMOD_BY,
    NC_TASKSCHEDULE.PK_TASKSCHEDULE_ID,
    R_MESSAGESTRUCT_TASK.FK_MESSAGESTRUCT_ID,
    R_AGENT_ESCALATIONAGENT.FK_CHILD_AGENT_ID,
    R_RULE_PARAMETER.LITERAL_TYPE,
    R_RULE_PARAMETER.FK_RULE_ID,
    NC_RULE.FK_RULETYPE
FROM
    R_AGENT_ESCALATIONAGENT,
    NC_OBJECTCATALOGUE,
    NC_TASK,
    NC_TASKSCHEDULE,
    R_MESSAGESTRUCT_TASK,
    NC_RULE,
    R_RULE_PARAMETER
WHERE
    R_RULE_PARAMETER.FK_RULE_ID = NC_RULE.PK_RULE_ID(+)
    AND   NC_TASK.PK_TASK_ID = R_MESSAGESTRUCT_TASK.FK_TASK_ID(+)
    AND   NC_TASK.PK_TASK_ID = R_AGENT_ESCALATIONAGENT.FK_PARENT_AGENT_ID(+)
    AND   NC_TASK.PK_TASK_ID = R_RULE_PARAMETER.FK_TASK_ID(+)
    AND   NC_TASK.PK_TASK_ID = NC_TASKSCHEDULE.FK_TASK_ID(+)
    AND   NC_TASK.PK_TASK_ID = NC_OBJECTCATALOGUE.PK_OID(+);
    


CREATE VIEW V_BIE_COMPLETE AS SELECT 
   NC_BIE.PK_BIE_ID AS BIE_PK_ID, 
   NC_BIETOPIC.FK_BIE_ID AS BIETOPIC_FK_BIE_ID, 
   NC_BIETOPIC.FK_CALC_ID AS BIETOPIC_FK_CALC_ID,  
   NULL AS CALC_LINK_PK_ID,
   NC_BIE.NAME AS BIE_NAME, 
   NC_BIE.DESCRIPTION AS BIE_DESCRIPTION, 
   NC_BIE.MOD_CNT AS BIE_MODCOUNT, 
   NC_BIETOPIC.NAME AS BIETOPIC_NAME,       
   NC_BIETOPIC.DESCRIPTION AS BIETOPIC_DESCRIPTION, 
   NC_BIETOPIC.PK_BIETOPIC_ID AS BIETOPIC_PK_ID,      
   NC_BIETOPIC.TYPE AS BIETOPIC_TYPE,       
   NC_BIETOPIC.MODCOUNT AS BIETOPIC_MODCOUNT,   
   NC_BIETOPIC.FK_DMT_ID AS BIETOPIC_FK_DMT_ID,  
   NC_DMTOPIC.OBJ_TYPE AS TOPIC_OBJ_TYPE,     
   NC_DMTOPIC.PK_TOPIC_ID AS DMT_PK_ID,          
   NC_DMTOPIC.NAME AS DMT_NAME,           
   NC_DMTOPIC.DESCRIPTION AS DMT_DESCRIPTION,    
   NC_DMTOPIC.COLUMN_NAME AS DMT_COLUMN_NAME,    
   NC_DMTOPIC.DRE_COLUMN_NAME AS DMT_DRE_COLUMN_NAME,
   NC_DMTOPIC.TABLE_NAME AS DMT_TABLE_NAME,     
   NC_DMTOPIC.COLUMN_TYPE AS DMT_COLUMN_TYPE,    
   NC_DMTOPIC.FK_DM_ID AS DMT_FK_DM_ID,       
   NC_DMTOPIC.PP_TOPIC_VALUE AS DMT_PP_VALUE,       
   ' ' AS CALC_LINK_NAME, 
   ' ' AS CALC_LINK_DESCRIPTION, 
   NULL AS CALC_LINK_LHS_TOPIC_ID, 
   ' ' AS CALC_LINK_FK_RHSTYPE, 
   ' ' AS CALC_LINK_OPERATOR, 
   ' ' AS CALC_LINK_NUMERIC_LITERAL, 
   ' ' AS CALC_LINK_STRING_LITERAL, 
   ' ' AS CALC_LINK_DATE_LITERAL, 
   NULL AS CALC_LINK_FK_BIETOPIC_ID, 
   NC_RULE.FK_BIE_ID AS RULE_FK_BIE_ID, 
   NC_RULE.PK_RULE_ID AS RULE_PK_ID, 
   NC_RULE.NAME AS RULE_NAME, 
   NC_RULE.DESCRIPTION AS RULE_DESCRIPTION, 
   NC_RULE.FK_RULETYPE AS RULE_FK_RULETYPE, 
   NC_RULE.DATE_LITERAL AS RULE_DATE_LITERAL, 
   NC_RULE.STRING_LITERAL AS RULE_STRING_LITERAL, 
   NC_RULE.NUMERIC_LITERAL AS RULE_NUMERIC_LITERAL, 
   NC_RULE.LHS_TOPIC_ID AS RULE_LHS_TOPIC_ID, 
   NC_RULE.OPERATOR AS RULE_OPERATOR, 
   NC_RULE.FK_RHSTYPE AS RULE_FK_RHSTYPE, 
   NC_RULE.RHS_TOPIC_ID AS RULE_RHS_TOPIC_ID, 
   NC_RULE.RHS_OPTION AS RULE_RHS_OPTION, 
   NC_RULE.RHS_BIE_ID AS RULE_RHS_BIE_ID
FROM 
      NC_BIE, 
      NC_RULE,
      NC_BIETOPIC,
      NC_DMTOPIC
WHERE 
       NC_BIE.PK_BIE_ID = NC_RULE.FK_BIE_ID(+) 
  AND  NC_BIE.PK_BIE_ID =  NC_BIETOPIC.FK_BIE_ID(+)
  AND  NC_BIETOPIC.FK_DMT_ID = NC_DMTOPIC.PK_TOPIC_ID(+);
  
-------------------------------------------------------------------------------
--$220-- server data inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES (3,'build no.');

-------------------------------------------------------------------------------
--$230-- restore inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_DATAMAPPING (PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,
LASTMOD_BY,LASTMOD_TIME,MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL ,NIC)
SELECT PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,
MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL,NIC FROM X_DATAMAPPING;

INSERT INTO NC_SCHEDULE
(PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,SCHEDULE_TYPE,
TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,VALID_SCHEDULE,USE_DAY_NUMBER,
DAY_OF_MONTH,DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,MONTH_OF_YEAR,REPEAT_INTERVAL,
DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,FIXED_INTERVAL_IN_MILLIS)
SELECT 
PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,SCHEDULE_TYPE,
TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,VALID_SCHEDULE,USE_DAY_NUMBER,
DAY_OF_MONTH,DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,MONTH_OF_YEAR,REPEAT_INTERVAL,
DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,FIXED_INTERVAL_IN_MILLIS
FROM XC_SCHEDULE;

INSERT INTO R_NEWSITEMS_NCOBJECTS 
	SELECT NID,FK_NCID,TYPE FROM X_NEWSITEMS_NCOBJECTS
	WHERE TYPE IN (905,906,907,908);

INSERT INTO R_NEWSVIEWS_NCOBJECTS
 	SELECT VID,NID,FK_NCID FROM X_NEWSITEMS_NCOBJECTS
	WHERE TYPE NOT IN (905,906,907,908);

-------------------------------------------------------------------------------
--$240-- foreign keys add begin
-------------------------------------------------------------------------------

ALTER TABLE NC_DATAMAPPING
   ADD (CONSTRAINT F9N_DATAMAPPING FOREIGN KEY (FK_PPDS_ID)
      REFERENCES NC_COGNOS_DS);

ALTER TABLE NC_DATAMAPPING
   ADD (CONSTRAINT F5N_DATAMAPPING FOREIGN KEY (FK_DS_ID)
      REFERENCES NC_CONFIG_DS);

ALTER TABLE R_NEWSVIEWS_NCOBJECTS
   ADD (CONSTRAINT F2R_NEWSVIEWS_NCOB FOREIGN KEY (NID)
      REFERENCES R_NEWSITEMS_NCOBJECTS);

ALTER TABLE R_TASKSCHEDULE_SCHEDULE
   ADD (CONSTRAINT F2R_TASKSCHEDULE_S FOREIGN KEY (FK_SCHEDULE_ID)
      REFERENCES NC_SCHEDULE);

-------------------------------------------------------------------------------
--$250-- backup drop begin
-------------------------------------------------------------------------------

DROP TABLE X_DATAMAPPING;

DROP TABLE XC_SCHEDULE;

DROP TABLE X_NEWSITEMS_NCOBJECTS;

-------------------------------------------------------------------------------
--$260-- end sql by function
-------------------------------------------------------------------------------
--	END NC3_UPDATE_ORA.SQL			*	DO NOT EDIT	 * 		COMMIT 
-------------------------------------------------------------------------------
