--UPDATE FROM 8.6.0.4 TO 8.6.0.5


DROP TABLE VERSION_8_6_0_4;



/*  VERSION_8_6_0_5  */
CREATE TABLE VERSION_8_6_0_5 (
	 DUMMY	NUMBER	    NULL
)
;

create table SRDS (
	SRDS_ID NUMBER(30,0) not null,
	SRDS_DATE DATE not null,
	SRDS_ZDCO_ID NUMBER(30,0) not null,
	SRDS_YCAD_ID NUMBER(30,0) not null,
	SRDS_NETREV_D NUMBER(30,4) null,
	SRDS_GROSSREV_D NUMBER(30,4) null,
	SRDS_NETREV_M NUMBER(30,4) null,
	SRDS_GROSSREV_M NUMBER(30,4) null,
	SRDS_NETREV_Y NUMBER(30,4) null,
	SRDS_GROSSREV_Y NUMBER(30,4) null,
	SRDS_PARTNER_ID NUMBER(30,0) null,
	SRDS_IMPORTED NUMBER(1,0) null,
	SRDS_WPHS_ID NUMBER(30,0) null,
	SRDS_ZDCO_LONGDESC VARCHAR2(30) null,
	SRDS_ZDCO_NUMERICDESC NUMBER(5,0) null,
	SRDS_ZDCG_LONGDESC VARCHAR2(30) null,
	SRDS_ZDCO_CDT NUMBER(1,0) null, constraint SRDS_PK primary key (SRDS_ID) using index tablespace v8index  ) tablespace v8main ; 

CREATE SEQUENCE SEQ_SRDS INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

CREATE TABLE SMAD
(
  SMAD_ID                       NUMBER(30)      NOT NULL,
  SMAD_DATE                     DATE            NOT NULL,
  SMAD_YCAD_ID                  NUMBER(30)      NOT NULL,
  SMAD_ADULTS_D                 NUMBER(5),
  SMAD_ADULTS_M                 NUMBER(5),
  SMAD_ADULTS_Y                 NUMBER(7),
  SMAD_CHILDS_D                 NUMBER(5),
  SMAD_CHILDS_M                 NUMBER(5),
  SMAD_CHILDS_Y                 NUMBER(7),
  SMAD_ROOMS_OCC_D              NUMBER(5),
  SMAD_ROOMS_OCC_M              NUMBER(5),
  SMAD_ROOMS_OCC_Y              NUMBER(7),
  SMAD_ROOMSINHOTEL_D           NUMBER(5),
  SMAD_ROOMSINHOTEL_M           NUMBER(5),
  SMAD_ROOMSINHOTEL_Y           NUMBER(7),
  SMAD_ROOMS_OOO_D              NUMBER(5),
  SMAD_ROOMS_OOO_M              NUMBER(5),
  SMAD_ROOMS_OOO_Y              NUMBER(7),
  SMAD_WALKIN_D                 NUMBER(5),
  SMAD_WALKIN_M                 NUMBER(5),
  SMAD_WALKIN_Y                 NUMBER(7),
  SMAD_ARR_ROOMS_D              NUMBER(5),
  SMAD_ARR_ROOMS_M              NUMBER(5),
  SMAD_ARR_ROOMS_Y              NUMBER(7),
  SMAD_DEP_ROOMS_D              NUMBER(5),
  SMAD_DEP_ROOMS_M              NUMBER(5),
  SMAD_DEP_ROOMS_Y              NUMBER(7),
  SMAD_ARR_ADULTS_D             NUMBER(5),
  SMAD_ARR_ADULTS_M             NUMBER(5),
  SMAD_ARR_ADULTS_Y             NUMBER(7),
  SMAD_ARR_CHILDS_D             NUMBER(5),
  SMAD_ARR_CHILDS_M             NUMBER(5),
  SMAD_ARR_CHILDS_Y             NUMBER(7),
  SMAD_DEP_ADULTS_D             NUMBER(5),
  SMAD_DEP_ADULTS_M             NUMBER(5),
  SMAD_DEP_ADULTS_Y             NUMBER(7),
  SMAD_DEP_CHILDS_D             NUMBER(5),
  SMAD_DEP_CHILDS_M             NUMBER(5),
  SMAD_DEP_CHILDS_Y             NUMBER(7),
  SMAD_TOTALGROSSREV_D          NUMBER(30,4),
  SMAD_TOTALGROSSREV_M          NUMBER(30,4),
  SMAD_TOTALGROSSREV_Y          NUMBER(30,4),
  SMAD_TOTALNETREV_D            NUMBER(30,4),
  SMAD_TOTALNETREV_M            NUMBER(30,4),
  SMAD_TOTALNETREV_Y            NUMBER(30,4),
  SMAD_COMPROOMS_D              NUMBER(5),
  SMAD_COMPROOMS_M              NUMBER(5),
  SMAD_COMPROOMS_Y              NUMBER(7),
  SMAD_HOUSEUSEROOMS_D          NUMBER(5),
  SMAD_HOUSEUSEROOMS_M          NUMBER(5),
  SMAD_HOUSEUSEROOMS_Y          NUMBER(7),
  SMAD_BEDSINHOTEL_D            NUMBER(5),
  SMAD_BEDSINHOTEL_M            NUMBER(5),
  SMAD_BEDSINHOTEL_Y            NUMBER(7),
  SMAD_REPEATGUESTARRROOM_D     NUMBER(5),
  SMAD_REPEATGUESTARRROOM_M     NUMBER(5),
  SMAD_REPEATGUESTARRROOM_Y     NUMBER(7),
  SMAD_RESMADETODAY_D           NUMBER(5),
  SMAD_RESMADETODAY_M           NUMBER(5),
  SMAD_RESMADETODAY_Y           NUMBER(7),
  SMAD_RESCANCELEDTODAY_D       NUMBER(5),
  SMAD_RESCANCELEDTODAY_M       NUMBER(5),
  SMAD_RESCANCELEDTODAY_Y       NUMBER(7),
  SMAD_ARRADULTSTOMORROW_D      NUMBER(5),
  SMAD_DEPADULTSTOMORROW_D      NUMBER(5),
  SMAD_ARRROOMSTOMORROW_D       NUMBER(5),
  SMAD_DEPROOMSTOMORROW_D       NUMBER(5),
  SMAD_COMPANY_ROOMS_D          NUMBER(5),
  SMAD_COMPANY_ROOMS_M          NUMBER(5),
  SMAD_COMPANY_ROOMS_Y          NUMBER(7),
  SMAD_COMPANY_REV_GROSS_D      NUMBER(30,4),
  SMAD_COMPANY_REV_GROSS_M      NUMBER(30,4),
  SMAD_COMPANY_REV_GROSS_Y      NUMBER(30,4),
  SMAD_AGENT_ROOMS_D            NUMBER(5),
  SMAD_AGENT_ROOMS_M            NUMBER(5),
  SMAD_AGENT_ROOMS_Y            NUMBER(7),
  SMAD_AGENT_REV_GROSS_D        NUMBER(30,4),
  SMAD_AGENT_REV_GROSS_M        NUMBER(30,4),
  SMAD_AGENT_REV_GROSS_Y        NUMBER(30,4),
  SMAD_IND_ROOMS_D              NUMBER(5),
  SMAD_IND_ROOMS_M              NUMBER(5),
  SMAD_IND_ROOMS_Y              NUMBER(7),
  SMAD_IND_REV_GROSS_D          NUMBER(30,4),
  SMAD_IND_REV_GROSS_M          NUMBER(30,4),
  SMAD_IND_REV_GROSS_Y          NUMBER(30,4),
  SMAD_VIPADULTS_D              NUMBER(5),
  SMAD_VIPADULTS_M              NUMBER(5),
  SMAD_VIPADULTS_Y              NUMBER(7),
  SMAD_PAYMENTS_D               NUMBER(30,4),
  SMAD_PAYMENTS_M               NUMBER(30,4),
  SMAD_PAYMENTS_Y               NUMBER(30,4),
  SMAD_ROOMREVGROSS_D           NUMBER(30,4),
  SMAD_ROOMREVGROSS_M           NUMBER(30,4),
  SMAD_ROOMREVGROSS_Y           NUMBER(30,4),
  SMAD_ROOMREVNET_D             NUMBER(30,4),
  SMAD_ROOMREVNET_M             NUMBER(30,4),
  SMAD_ROOMREVNET_Y             NUMBER(30,4),
  SMAD_CANCFORTODAY_D           NUMBER(5),
  SMAD_CANCFORTODAY_M           NUMBER(5),
  SMAD_CANCFORTODAY_Y           NUMBER(7),
  SMAD_DEPNOTPAID_D             NUMBER(5),
  SMAD_DEPNOTPAID_M             NUMBER(5),
  SMAD_DEPNOTPAID_Y             NUMBER(7),
  SMAD_NOSHOWROOMS_D            NUMBER(5),
  SMAD_NOSHOWROOMS_M            NUMBER(5),
  SMAD_NOSHOWROOMS_Y            NUMBER(7),
  SMAD_DAYUSEROOMS_D            NUMBER(5),
  SMAD_DAYUSEROOMS_M            NUMBER(5),
  SMAD_DAYUSEROOMS_Y            NUMBER(7),
  SMAD_MAXBEDSINHOTEL_D         NUMBER(5),
  SMAD_MAXBEDSINHOTEL_M         NUMBER(5),
  SMAD_MAXBEDSINHOTEL_Y         NUMBER(7),
  SMAD_TOTALGROSSNHTLREV_D      NUMBER(30,4),
  SMAD_TOTALGROSSNHTLREV_M      NUMBER(30,4),
  SMAD_TOTALGROSSNHTLREV_Y      NUMBER(30,4),
  SMAD_TOTALNETNHTLREV_D        NUMBER(30,4),
  SMAD_TOTALNETNHTLREV_M        NUMBER(30,4),
  SMAD_TOTALNETNHTLREV_Y        NUMBER(30,4),
  SMAD_COMPANY_NHTLREV_GROSS_D  NUMBER(30,4),
  SMAD_COMPANY_NHTLREV_GROSS_M  NUMBER(30,4),
  SMAD_COMPANY_NHTLREV_GROSS_Y  NUMBER(30,4),
  SMAD_AGENT_NHTLREV_GROSS_D    NUMBER(30,4),
  SMAD_AGENT_NHTLREV_GROSS_M    NUMBER(30,4),
  SMAD_AGENT_NHTLREV_GROSS_Y    NUMBER(30,4),
  SMAD_IND_NHTLREV_GROSS_D      NUMBER(30,4),
  SMAD_IND_NHTLREV_GROSS_M      NUMBER(30,4),
  SMAD_IND_NHTLREV_GROSS_Y      NUMBER(30,4),
  SMAD_ROOMNHTLREVGROSS_D       NUMBER(30,4),
  SMAD_ROOMNHTLREVGROSS_M       NUMBER(30,4),
  SMAD_ROOMNHTLREVGROSS_Y       NUMBER(30,4),
  SMAD_ROOMNHTLREVNET_D         NUMBER(30,4),
  SMAD_ROOMNHTLREVNET_M         NUMBER(30,4),
  SMAD_ROOMNHTLREVNET_Y         NUMBER(30,4),
  SMAD_FBREVGROSS_D             NUMBER(30,4),
  SMAD_FBREVGROSS_M             NUMBER(30,4),
  SMAD_FBREVGROSS_Y             NUMBER(30,4),
  SMAD_FBNHTLREVGROSS_D         NUMBER(30,4),
  SMAD_FBNHTLREVGROSS_M         NUMBER(30,4),
  SMAD_FBNHTLREVGROSS_Y         NUMBER(30,4),
  SMAD_FBREVNET_D               NUMBER(30,4),
  SMAD_FBREVNET_M               NUMBER(30,4),
  SMAD_FBREVNET_Y               NUMBER(30,4),
  SMAD_FBNHTLREVNET_D           NUMBER(30,4),
  SMAD_FBNHTLREVNET_M           NUMBER(30,4),
  SMAD_FBNHTLREVNET_Y           NUMBER(30,4),
  SMAD_OCCTOMORROW              NUMBER(30,4),
  SMAD_OCCNEXTSEVENDAYS         NUMBER(30,4),
  SMAD_OCCUNTILENDMONTH         NUMBER(30,4),
  SMAD_OCCENDYEAR               NUMBER(30,4),
  SMAD_OCCNEXTFOURWEEKS         NUMBER(30,4),
  SMAD_SOURCE_ROOMS_D           NUMBER(5),
  SMAD_SOURCE_ROOMS_M           NUMBER(5),
  SMAD_SOURCE_ROOMS_Y           NUMBER(7),
  SMAD_SOURCE_REV_GROSS_D       NUMBER(30,4),
  SMAD_SOURCE_REV_GROSS_M       NUMBER(30,4),
  SMAD_SOURCE_REV_GROSS_Y       NUMBER(30,4),
  SMAD_BOOKER_ROOMS_D           NUMBER(5),
  SMAD_BOOKER_ROOMS_M           NUMBER(5),
  SMAD_BOOKER_ROOMS_Y           NUMBER(7),
  SMAD_BOOKER_REV_GROSS_D       NUMBER(30,4),
  SMAD_BOOKER_REV_GROSS_M       NUMBER(30,4),
  SMAD_BOOKER_REV_GROSS_Y       NUMBER(30,4),
  SMAD_VENDOR_ROOMS_D           NUMBER(5),
  SMAD_VENDOR_ROOMS_M           NUMBER(5),
  SMAD_VENDOR_ROOMS_Y           NUMBER(7),
  SMAD_VENDOR_REV_GROSS_D       NUMBER(30,4),
  SMAD_VENDOR_REV_GROSS_M       NUMBER(30,4),
  SMAD_VENDOR_REV_GROSS_Y       NUMBER(30,4),
  SMAD_MPLANER_ROOMS_D          NUMBER(5),
  SMAD_MPLANER_ROOMS_M          NUMBER(5),
  SMAD_MPLANER_ROOMS_Y          NUMBER(7),
  SMAD_MPLANER_REV_GROSS_D      NUMBER(30,4),
  SMAD_MPLANER_REV_GROSS_M      NUMBER(30,4),
  SMAD_MPLANER_REV_GROSS_Y      NUMBER(30,4),
  SMAD_SOURCE_NHTLREV_GROSS_D   NUMBER(30,4),
  SMAD_SOURCE_NHTLREV_GROSS_M   NUMBER(30,4),
  SMAD_SOURCE_NHTLREV_GROSS_Y   NUMBER(30,4),
  SMAD_BOOKER_NHTLREV_GROSS_D   NUMBER(30,4),
  SMAD_BOOKER_NHTLREV_GROSS_M   NUMBER(30,4),
  SMAD_BOOKER_NHTLREV_GROSS_Y   NUMBER(30,4),
  SMAD_VENDOR_NHTLREV_GROSS_D   NUMBER(30,4),
  SMAD_VENDOR_NHTLREV_GROSS_M   NUMBER(30,4),
  SMAD_VENDOR_NHTLREV_GROSS_Y   NUMBER(30,4),
  SMAD_MPLANER_NHTLREV_GROSS_D  NUMBER(30,4),
  SMAD_MPLANER_NHTLREV_GROSS_M  NUMBER(30,4),
  SMAD_MPLANER_NHTLREV_GROSS_Y  NUMBER(30,4),
  SMAD_MINIREVGROSS_D           NUMBER(30,4),
  SMAD_MININHTLREVGROSS_D       NUMBER(30,4),
  SMAD_TELEREVGROSS_D           NUMBER(30,4),
  SMAD_TELENHTLREVGROSS_D       NUMBER(30,4),
  SMAD_MISCREVGROSS_D           NUMBER(30,4),
  SMAD_MISCNHTLREVGROSS_D       NUMBER(30,4),
  SMAD_NOSTATREVGROSS_D         NUMBER(30,4),
  SMAD_NOSTATNHTLREVGROSS_D     NUMBER(30,4),
  SMAD_MINIREVGROSS_M           NUMBER(30,4),
  SMAD_MININHTLREVGROSS_M       NUMBER(30,4),
  SMAD_TELEREVGROSS_M           NUMBER(30,4),
  SMAD_TELENHTLREVGROSS_M       NUMBER(30,4),
  SMAD_MISCREVGROSS_M           NUMBER(30,4),
  SMAD_MISCNHTLREVGROSS_M       NUMBER(30,4),
  SMAD_NOSTATREVGROSS_M         NUMBER(30,4),
  SMAD_NOSTATNHTLREVGROSS_M     NUMBER(30,4),
  SMAD_MINIREVGROSS_Y           NUMBER(30,4),
  SMAD_MININHTLREVGROSS_Y       NUMBER(30,4),
  SMAD_TELEREVGROSS_Y           NUMBER(30,4),
  SMAD_TELENHTLREVGROSS_Y       NUMBER(30,4),
  SMAD_MISCREVGROSS_Y           NUMBER(30,4),
  SMAD_MISCNHTLREVGROSS_Y       NUMBER(30,4),
  SMAD_NOSTATREVGROSS_Y         NUMBER(30,4),
  SMAD_NOSTATNHTLREVGROSS_Y     NUMBER(30,4),
  SMAD_MINIREVNET_D             NUMBER(30,4),
  SMAD_MININHTLREVNET_D         NUMBER(30,4),
  SMAD_TELEREVNET_D             NUMBER(30,4),
  SMAD_TELENHTLREVNET_D         NUMBER(30,4),
  SMAD_MISCREVNET_D             NUMBER(30,4),
  SMAD_MISCNHTLREVNET_D         NUMBER(30,4),
  SMAD_NOSTATREVNET_D           NUMBER(30,4),
  SMAD_NOSTATNHTLREVNET_D       NUMBER(30,4),
  SMAD_MINIREVNET_M             NUMBER(30,4),
  SMAD_MININHTLREVNET_M         NUMBER(30,4),
  SMAD_TELEREVNET_M             NUMBER(30,4),
  SMAD_TELENHTLREVNET_M         NUMBER(30,4),
  SMAD_MISCREVNET_M             NUMBER(30,4),
  SMAD_MISCNHTLREVNET_M         NUMBER(30,4),
  SMAD_NOSTATREVNET_M           NUMBER(30,4),
  SMAD_NOSTATNHTLREVNET_M       NUMBER(30,4),
  SMAD_MINIREVNET_Y             NUMBER(30,4),
  SMAD_MININHTLREVNET_Y         NUMBER(30,4),
  SMAD_TELEREVNET_Y             NUMBER(30,4),
  SMAD_TELENHTLREVNET_Y         NUMBER(30,4),
  SMAD_MISCREVNET_Y             NUMBER(30,4),
  SMAD_MISCNHTLREVNET_Y         NUMBER(30,4),
  SMAD_NOSTATREVNET_Y           NUMBER(30,4),
  SMAD_NOSTATNHTLREVNET_Y       NUMBER(30,4),
  SMAD_WALKEDFORTODAY_D         NUMBER(5),
  SMAD_WALKEDFORTODAY_M         NUMBER(6),
  SMAD_WALKEDFORTODAY_Y         NUMBER(7),
  SMAD_RESWALKEDTODAY_D         NUMBER(5),
  SMAD_RESWALKEDTODAY_M         NUMBER(6),
  SMAD_RESWALKEDTODAY_Y         NUMBER(7),
  SMAD_DOMESTICCHILDS_D         NUMBER(5),
  SMAD_DOMESTICCHILDS_M         NUMBER(5),
  SMAD_DOMESTICCHILDS_Y         NUMBER(5),
  SMAD_ARR_DOMESTICCHILDS_D     NUMBER(5),
  SMAD_ARR_DOMESTICCHILDS_M     NUMBER(5),
  SMAD_ARR_DOMESTICCHILDS_Y     NUMBER(5),
  SMAD_DEP_DOMESTICCHILDS_D     NUMBER(5),
  SMAD_DEP_DOMESTICCHILDS_M     NUMBER(5),
  SMAD_DEP_DOMESTICCHILDS_Y     NUMBER(5),
  SMAD_OCCNEXTFOURWEEKS_D       NUMBER(30,4),
  SMAD_OCCTOMORROW_D            NUMBER(30,4),
  SMAD_OCCNEXTSEVENDAYS_D       NUMBER(30,4),
  SMAD_OCCUNTILENDMONTH_D       NUMBER(30,4),
  SMAD_OCCENDYEAR_D             NUMBER(30,4),
  SMAD_OCCNEXTFOURWEEKS_T       NUMBER(30,4),
  SMAD_OCCTOMORROW_T            NUMBER(30,4),
  SMAD_OCCNEXTSEVENDAYS_T       NUMBER(30,4),
  SMAD_OCCUNTILENDMONTH_T       NUMBER(30,4),
  SMAD_OCCENDYEAR_T             NUMBER(30,4),
  SMAD_DAYCOUNT                 NUMBER(5),
  SMAD_PARTNER_ID               NUMBER(30),
  SMAD_IMPORTED                 NUMBER(1),
  SMAD_WPHS_ID                  NUMBER(30),
  SMAD_ROOMS_OOS_D              NUMBER(5),
  SMAD_ROOMS_OOS_M              NUMBER(5),
  SMAD_ROOMS_OOS_Y              NUMBER(7),
  SMAD_ROOMS_OCC_DFS_D          NUMBER(5),
  SMAD_ROOMS_OCC_DFS_M          NUMBER(5),
  SMAD_ROOMS_OCC_DFS_Y          NUMBER(7),
  SMAD_COMP_ADULTS_D            NUMBER(5),
  SMAD_COMP_ADULTS_M            NUMBER(5),
  SMAD_COMP_ADULTS_Y            NUMBER(7),
  SMAD_COMP_CHILDS_D            NUMBER(5),
  SMAD_COMP_CHILDS_M            NUMBER(5),
  SMAD_COMP_CHILDS_Y            NUMBER(7),
  CONSTRAINT SMAD_PK PRIMARY KEY (SMAD_ID) USING INDEX TABLESPACE V8INDEX
)
TABLESPACE V8MAIN
PCTUSED    40
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          40K
            NEXT             40K
            MINEXTENTS       1
            MAXEXTENTS       505
            PCTINCREASE      50
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOLOGGING
NOCACHE
NOPARALLEL;

CREATE SEQUENCE SEQ_SMAD INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

create table WCCK (
	WCCK_ID NUMBER(30,0) not null,
	WCCK_LICNAME VARCHAR2(60) not null,
	WCCK_DBID VARCHAR2(60) not null,
	WCCK_HDEFKEY VARCHAR2(60) null, constraint WCCK_PK primary key (WCCK_ID) using index tablespace v8index  ) tablespace v8main ; 

CREATE SEQUENCE SEQ_WCCK INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

ALTER TABLE MMOD ADD ( MMOD_ONEWAY NUMBER(1) DEFAULT 0 NOT NULL  );

create table XPWH (
	XPWH_ID NUMBER(30,0) not null,
	XPWH_XCED_ID NUMBER(30,0) not null,
	XPWH_PASSWORD VARCHAR2(30) not null,
	XPWH_CHNAGEDATE DATE not null, constraint XPWH_PK primary key (XPWH_ID) using index tablespace v8index  ) tablespace v8main ; 

CREATE SEQUENCE SEQ_XPWH INCREMENT BY 1 START WITH 1000 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

ALTER TABLE XCED ADD ( XCED_BADLOGIN NUMBER(2) NULL  );

ALTER TABLE SFTX ADD ( SFTX_ZWIN_ID NUMBER(30) NULL  );

ALTER TABLE SFTX ADD ( SFTX_ZINV_ID NUMBER(30) NULL  );
