CREATE TABLE SUBGRUTABPRECOM (
  CDFILIAL VARCHAR2(4) NOT NULL, 
  CDCIA VARCHAR2(4) NOT NULL, 
  NRTABPRECO VARCHAR2(3) NOT NULL, 
  NRSERVICOCIAFILIPRECO NUMBER(10) NOT NULL, 
  CDCLASSE VARCHAR2(4) NOT NULL, 
  CDCICLO VARCHAR2(4) NOT NULL, 
  NRSEQPRECO NUMBER(10) NOT NULL, 
  NRSUBGRUTABPRECOM NUMBER(10) NOT NULL, 
  CDMANCIA VARCHAR2(4) NOT NULL, 
  NRSERVICOCIAFILI NUMBER(10) NOT NULL, 
  CDSUBGRU VARCHAR2(10) NOT NULL, 
  NRSEQSUBGRUSEMAM NUMBER(10) NOT NULL, 
  CDPRODUTO VARCHAR2(10) DEFAULT NULL NULL, 
  CDRECEITA VARCHAR2(10) DEFAULT NULL NULL, 
  IDPROPSUBSEMAM VARCHAR2(1) DEFAULT NULL NULL, 
  QTPROPSUBSEMAM DOUBLE PRECISION DEFAULT NULL NULL, 
  VRPRECOSUBGRU VARCHAR2(10) 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
)
/
ALTER TABLE SUBGRUTABPRECOM ADD CONSTRAINT CKC_IDPROPSUBSEMAM_SUBGRTABPRE CHECK (IDPROPSUBSEMAM IN ('1','2','3','4','5'))
/
ALTER TABLE SUBGRUTABPRECOM ADD CONSTRAINT CKC_IDATIVO_SUBGRUTABPRECOM CHECK (IDATIVO IN ('S','N'))