CREATE TABLE ESO_NATUREZALESAO (
  NRNATUREZALESAO NUMBER(10) NOT NULL, 
  DSNATUREZALESAO VARCHAR2(700) NOT NULL, 
  CDESOCIAL VARCHAR2(9) NOT NULL, 
  NRORG VARCHAR2(4000) 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, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_ESO_NATUREZALESAO PRIMARY KEY(NRNATUREZALESAO)
)
/
ALTER TABLE ESO_NATUREZALESAO ADD CONSTRAINT CKC_IDATIVO_NATUREZALESAO CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE SST_NATUREZA ADD (
  NRNATUREZALESAO NUMBER(10) DEFAULT NULL NULL
)
/
ALTER TABLE SST_NATUREZA ADD CONSTRAINT FKHCM00031NATUREZALESAO FOREIGN KEY (NRNATUREZALESAO) REFERENCES ESO_NATUREZALESAO (NRNATUREZALESAO)