--UPDATE FROM 8.6.0.2 TO 8.6.0.3


DROP TABLE VERSION_8_6_0_2;



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

ALTER TABLE ZFAG ADD ( ZFAG_YCAD_ID NUMBER(30) NULL  );

ALTER TABLE YFRE MODIFY ( YFRE_XCMS_GLOBALID NUMBER(30)  );

ALTER TABLE YGRT ADD ( YGRT_ROLE NUMBER(1) DEFAULT 1  );

ALTER TABLE YGRT MODIFY ( YGRT_CONTACT_XCMS_ID NULL  );

ALTER TABLE YBOM ADD ( YBOM_YGRT_ID NUMBER(30) NULL  );


--Industry Code

update XPAC set  XPAC_APPLIND=0 where xpac_id=1;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=1;

-- Competition

update XPAC set XPAC_APPLIND=0 where xpac_id=2;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=2;

-- Scope

update XPAC set XPAC_APPLIND=1 where xpac_id=3;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=3;

-- Product Interest

update XPAC set XPAC_APPLIND=1 where xpac_id=4;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=4;

-- Action Codes

update XPAC set XPAC_APPLIND=1 where xpac_id=5;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=5;

-- Influence

update XPAC set XPAC_APPLIND=1 where xpac_id=6;

update XPAC set XPAC_APPLCOMP=0 where xpac_id=6;

-- Preferred Distributon Method

update XPAC set XPAC_APPLIND=1 where xpac_id=7;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=7;

-- Scope City

update XPAC set XPAC_APPLIND=1 where xpac_id=8;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=8;

-- Potential

update XPAC set XPAC_APPLIND=0 where xpac_id=9;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=9;

-- Sales Territory

update XPAC set XPAC_APPLIND=0 where xpac_id=10;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=10;

-- Vip Codes

update XPAC set XPAC_APPLIND=1 where xpac_id=11;

update XPAC set XPAC_APPLCOMP=0 where xpac_id=11;

-- Simple Commission

update XPAC set XPAC_APPLIND=0 where xpac_id=12;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=12;

-- Mailing Codes

update XPAC set XPAC_APPLIND=1 where xpac_id=13;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=13;

-- Primary Sales Office

update XPAC set XPAC_APPLIND=0 where xpac_id=14;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=14;

-- Source

update XPAC set XPAC_APPLIND=1 where xpac_id=15;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=15;

-- Priority

update XPAC set XPAC_APPLIND=0 where xpac_id=16;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=16;

-- Newspapers

update XPAC set XPAC_APPLIND=1 where xpac_id=17;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=17;

-- Specials

update XPAC set XPAC_APPLIND=1 where xpac_id=18;

update XPAC set XPAC_APPLCOMP=1 where xpac_id=18;


-- Priority

update XPAC set XPAC_DISPLORDER=1 where xpac_id=16;

-- Industry Code

update XPAC set XPAC_DISPLORDER=2 where xpac_id=1;

-- Competition Code

update XPAC set XPAC_DISPLORDER=3 where xpac_id=2;

-- Scope

update XPAC set XPAC_DISPLORDER=4 where xpac_id=3;

-- Scope City

update XPAC set XPAC_DISPLORDER=5 where xpac_id=8;

-- Influence

update XPAC set XPAC_DISPLORDER=6 where xpac_id=6;

-- Potentials

update XPAC set XPAC_DISPLORDER=7 where xpac_id=9;

-- Preferred Distribution Method

update XPAC set XPAC_DISPLORDER=8 where xpac_id=7;

-- Product Interest 

update XPAC set XPAC_DISPLORDER=9 where xpac_id=4;

-- Action Codes

update XPAC set XPAC_DISPLORDER=10 where xpac_id=5;

-- Mailing Codes

update XPAC set XPAC_DISPLORDER=11 where xpac_id=13;

-- Newspapers

update XPAC set XPAC_DISPLORDER=12 where xpac_id=17;

-- Specials

update XPAC set XPAC_DISPLORDER=13 where xpac_id=18;

-- Source

update XPAC set XPAC_DISPLORDER=14 where xpac_id=15;

-- Sales Territory

update XPAC set XPAC_DISPLORDER=15 where xpac_id=10;

-- Primary Sales Office

update XPAC set XPAC_DISPLORDER=16 where xpac_id=14;

-- Vip Codes

update XPAC set XPAC_DISPLORDER=17 where xpac_id=11;

-- Simple Commision

update XPAC set XPAC_DISPLORDER=18 where xpac_id=12;


update XPAC set XPAC_LONGDESC='Pref.Distribution' where xpac_id=7;


ALTER TABLE XPAC ADD ( XPAC_MANDATORYCOMP NUMBER(1) NULL  );

ALTER TABLE XPAC ADD ( XPAC_MANDATORYIND NUMBER(1) NULL  );

DROP TABLE INFO_REPORTS CASCADE CONSTRAINTS;

create table WMST (
	WMST_ID NUMBER(30,0) not null,
	WMST_SHORTDESC VARCHAR2(3) null,
	WMST_LONGDESC VARCHAR2(30) null,
	WMST_UNIT VARCHAR2(10) null,
	WMST_DISPLORDER NUMBER(6,0) null,
	WMST_INACTIVE NUMBER(1,0) null, constraint WMST_PK primary key (WMST_ID) using index tablespace v8index  ) tablespace v8conf ; 

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

create table WMAS (
	WMAS_ID NUMBER(30,0) not null,
	WMAS_WMST_ID number(30,0) not null,
	WMAS_DATE DATE null,
	WMAS_VALUE NUMBER(30,4) null,
	WMAS_FREETEXT VARCHAR2(1000) null, constraint WMAS_PK primary key (WMAS_ID) using index tablespace v8index  ) tablespace v8main ; 

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