CREATE TABLE PREVPAXSUBGRUPRODM (
  CDFILIAL VARCHAR2(4) NOT NULL, 
  NRPREVISAOPROD NUMBER(10) NOT NULL, 
  NRPREVSUBGRU NUMBER(10) NOT NULL, 
  NRCALCCLAPROD NUMBER(10) NOT NULL, 
  CDCIA VARCHAR2(4) NOT NULL, 
  NRSERVICOCIAFILIPRECO NUMBER(10) NOT NULL, 
  CDCLASSE VARCHAR2(4) NOT NULL, 
  CDCICLO VARCHAR2(4) NOT NULL, 
  CDMANCIA VARCHAR2(4) NOT NULL, 
  NRSERVICOCIAFILI NUMBER(10) NOT NULL, 
  CDSUBGRU VARCHAR2(10) NOT NULL, 
  NRSEQSUBGRUSEMAM NUMBER(10) NOT NULL, 
  IDPROPSUBSEMAM VARCHAR2(1) DEFAULT NULL NULL, 
  QTPROPSUBSEMAM DOUBLE PRECISION DEFAULT NULL NULL, 
  QTPAXATE DOUBLE PRECISION DEFAULT NULL NULL, 
  QTSUBGRU DOUBLE PRECISION DEFAULT NULL NULL, 
  NRORG NUMBER(10) DEFAULT 1 NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_PREVPAXSUBGRUPRODM PRIMARY KEY(CDFILIAL, NRPREVISAOPROD, NRPREVSUBGRU, NRORG)
)
/
ALTER TABLE PREVPAXSUBGRUPRODM ADD CONSTRAINT CKC_IDPROPSUBSEMAM_PREVPAXSUBG CHECK (IDPROPSUBSEMAM IN ('1','2','3','4','5'))
/
ALTER TABLE PREVPAXSUBGRUPRODM ADD CONSTRAINT CKC_IDATIVO_PREVPAXSUBGRUPRODM CHECK (IDATIVO IN ('S','N'))