---SO 20013072 SIC selection customer dialog

------------------------------SICCODE TABLE---------------------------

CREATE SEQUENCE SEQ_SICCODE
START WITH 1
INCREMENT BY 1;

CREATE TABLE SICCODE
(
	SICCODE_ID           NUMBER NOT NULL ,
	CODE                 VARCHAR2(6) NOT NULL ,
	DESCRIPTION          VARCHAR2(128) NOT NULL ,
	SYSTEMUSER_ID        NUMBER NOT NULL ,
	TIMESTAMP            DATE NOT NULL 
);

ALTER TABLE SICCODE
ADD CONSTRAINT  XPKSICCODE PRIMARY KEY (SICCODE_ID);

CREATE UNIQUE INDEX XAK1SICCODE ON SICCODE
(CODE   ASC);

ALTER TABLE SICCODE
ADD CONSTRAINT  XAK1SICCODE UNIQUE (CODE);

------------------------------CUSTOMER TABLE---------------------------

ALTER TABLE CUSTOMER
	ADD (SICCODE_ID NUMBER);


CREATE  INDEX XIF44CUSTOMER ON CUSTOMER
(SICCODE_ID   ASC);

ALTER TABLE CUSTOMER
ADD CONSTRAINT CUSTOMER_SICCODE_ID FOREIGN KEY (SICCODE_ID) REFERENCES SICCODE (SICCODE_ID) ON DELETE SET NULL;

