CREATE TABLE METAVENDOPERAC (
  NRSEQMETAVENDOP NUMBER(10) NOT NULL, 
  CDMETAVENDA VARCHAR2(3) NOT NULL, 
  IDENTRSAIDOP VARCHAR2(1) NOT NULL, 
  CDTIPOOPER VARCHAR2(2) 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_METAVENDOPERAC PRIMARY KEY(NRSEQMETAVENDOP)
)
/
ALTER TABLE METAVENDOPERAC ADD CONSTRAINT FKPED00385METAVENDA FOREIGN KEY (CDMETAVENDA, NRORG) REFERENCES METAVENDA (CDMETAVENDA, NRORG)
/
ALTER TABLE METAVENDOPERAC ADD CONSTRAINT FKPED00386TIPOOPERAC FOREIGN KEY (IDENTRSAIDOP, CDTIPOOPER, NRORG) REFERENCES TIPOOPERAC (IDENTRSAIDOP, CDTIPOOPER, NRORG)