CREATE TABLE CLASSETIPOPROD (
  CDFILIAL VARCHAR2(4) NOT NULL, 
  CDCLASSE VARCHAR2(4) NOT NULL, 
  NRTIPOPROD NUMBER(10) NOT NULL, 
  NRORG NUMBER(10) DEFAULT 1 NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 's' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_CLASSETIPOPROD PRIMARY KEY(CDFILIAL, CDCLASSE, NRORG)
)
/
ALTER TABLE CLASSETIPOPROD ADD CONSTRAINT FKCOC00677CLASSE FOREIGN KEY (CDCLASSE, NRORG) REFERENCES CLASSE (CDCLASSE, NRORG)
/
ALTER TABLE CLASSETIPOPROD ADD CONSTRAINT FKCOC00678FILIAL FOREIGN KEY (CDFILIAL, NRORG) REFERENCES FILIAL (CDFILIAL, NRORG)
/
ALTER TABLE CLASSETIPOPROD ADD CONSTRAINT FKCOC00679TIPOPROD FOREIGN KEY (NRTIPOPROD, NRORG) REFERENCES TIPOPROD (NRTIPOPROD, NRORG)
/
ALTER TABLE CLASSETIPOPROD ADD CONSTRAINT CKC_IDATIVO_CLASSETIPOPROD CHECK (IDATIVO IN ('S','N'))
/
CREATE INDEX FKCOC00677CLASSE ON CLASSETIPOPROD (CDCLASSE, NRORG)
/
CREATE INDEX FKCOC00678FILIAL ON CLASSETIPOPROD (CDFILIAL, NRORG)
/
CREATE INDEX FKCOC00679TIPOPROD ON CLASSETIPOPROD (NRTIPOPROD, NRORG)