CREATE TABLE TABPRECOMENUGRID (
  CDCIA VARCHAR2(4) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  NRTABPRECO VARCHAR2(3) NOT NULL, 
  CDMANCIA VARCHAR2(4) 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_TABPRECOMENUGRID PRIMARY KEY(CDFILIAL, CDCIA, NRTABPRECO, CDMANCIA, NRORG)
)
/
ALTER TABLE TABPRECOMENUGRID ADD CONSTRAINT FKCOC000613MANUALCIAM FOREIGN KEY (CDFILIAL, CDCIA, CDMANCIA, NRORG) REFERENCES MANUALCIAM (CDFILIAL, CDCIA, CDMANCIA, NRORG)
/
ALTER TABLE TABPRECOMENUGRID ADD CONSTRAINT FKCOC00615TABPRECOSEM FOREIGN KEY (CDFILIAL, CDCIA, NRTABPRECO, NRORG) REFERENCES TABPRECOSEM (CDFILIAL, CDCIA, NRTABPRECO, NRORG)
/
ALTER TABLE TABPRECOMENUGRID ADD CONSTRAINT CKC_IDATIVO_TABPRECOMENUGRID CHECK (IDATIVO IN ('S','N'))