CREATE TABLE GPE_MATEPROCADJU
(
   NRMATERPROCADJU	NUMBER			NOT NULL,
   DSMATERPROCADJU	VARCHAR2(200)		NOT NULL, 
   CDESOCIAL		VARCHAR2(2)		NOT NULL,
   NRORG                       		NUMBER              		DEFAULT 1 NOT NULL,
   IDATIVO			VARCHAR2(1)		DEFAULT 'S' NOT NULL
	CONSTRAINT CKC_IDATIVO_MATPROC CHECK (IDATIVO IN ('N','S')),
   DTINCLUSAO		DATE			DEFAULT SYSDATE NOT NULL,
   DTULTATU		DATE			NULL,
   NRORGINCLUSAO		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERINCLUSAO		VARCHAR2(12)		DEFAULT '1' NULL ,
   NRORGULTATU		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERULTATU		VARCHAR2(12)		DEFAULT '1' NULL ,
	CONSTRAINT PK_GPE_MATEPROCADJU PRIMARY KEY (NRMATERPROCADJU)
)
/
CREATE TABLE GPE_PROCESSADMJUD
(
   NRPROCESSADMJUD	NUMBER			NOT NULL,
   DTINIVIGENCIA		DATE			DEFAULT SYSDATE NOT NULL,
   DTFIMVIGENCIA		DATE			NULL,
   NRTPPROCESSADJU	NUMBER			NOT NULL,
   NRESTRUTURAM 		NUMBER			NOT NULL,
   CDPROCESSADMJUD 	VARCHAR2(50)		NULL,
   NRMATERPROCADJU	NUMBER			NULL,
   NRPARCNEGOCIO		NUMBER			NULL,
   CDVARAPROCEADJU 	VARCHAR2(10)		NULL,
   SGUFVARAPROADJU 	VARCHAR2(2) 		NULL,
   CDMUNIVARPRADJU 	VARCHAR2(5) 		NULL,
   DSOBSERVACAO		VARCHAR2(500)		NULL,
   NRORG                       		NUMBER              		DEFAULT 1 NOT NULL,
   IDATIVO			VARCHAR2(1)		DEFAULT 'S' NOT NULL
	CONSTRAINT CKC_IDATIVO_PROCESSADMJUD CHECK (IDATIVO IN ('N','S')),
   DTINCLUSAO		DATE			DEFAULT SYSDATE NOT NULL,
   DTULTATU		DATE			NULL,
   NRORGINCLUSAO		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERINCLUSAO		VARCHAR2(12)		DEFAULT '1' NULL ,
   NRORGULTATU		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERULTATU		VARCHAR2(12)		DEFAULT '1' NULL ,
	CONSTRAINT PK_GPE_PROCESSADMJUD PRIMARY KEY (NRPROCESSADMJUD)
)
/
CREATE TABLE GPE_SUSPEXIGITPROC
(
   NRSUSPEXIGITPROC	NUMBER			NOT NULL,
   DSSUSPEXIGITPROC	VARCHAR2(200)		NOT NULL,
   CDESOCIAL		VARCHAR2(2)		NOT NULL,
   NRORG                       		NUMBER              		DEFAULT 1 NOT NULL,
   IDATIVO			VARCHAR2(1)		DEFAULT 'S' NOT NULL
	CONSTRAINT CKC_IDATIVO_SUSPEXIG CHECK (IDATIVO IN ('N','S')),
   DTINCLUSAO		DATE			DEFAULT SYSDATE NOT NULL,
   DTULTATU		DATE			NULL,
   NRORGINCLUSAO		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERINCLUSAO		VARCHAR2(12)		DEFAULT '1' NULL ,
   NRORGULTATU		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERULTATU		VARCHAR2(12)		DEFAULT '1' NULL ,
	CONSTRAINT PK_GPE_SUSPEXIGITPROC PRIMARY KEY (NRSUSPEXIGITPROC)
)
/
CREATE TABLE GPE_ITEMPROCADMJUD
(
    NRPROCESSADMJUD	NUMBER			NOT NULL,
   NRITEMPROCADMJUD	NUMBER			NOT NULL,
   DTITEMPROCADMJUD	DATE			DEFAULT SYSDATE NOT NULL,
   NRSUSPEXIGITPROC	NUMBER			NOT NULL,
   IDDEPOMONTITPROC	VARCHAR2(1)		DEFAULT 'S' NOT NULL
	   CONSTRAINT CKC_IDDEPOM_ITPROCE CHECK (IDDEPOMONTITPROC IN ('N','S')),
   DSOBSERVACAO		VARCHAR2(500)		NULL,
   NRORG                       		NUMBER              		DEFAULT 1 NOT NULL,
   IDATIVO			VARCHAR2(1)		DEFAULT 'S' NOT NULL
	CONSTRAINT CKC_IDATIVO_ITPROCE CHECK (IDATIVO IN ('N','S')),
   DTINCLUSAO		DATE			DEFAULT SYSDATE NOT NULL,
   DTULTATU		DATE			NULL,
   NRORGINCLUSAO	  	NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERINCLUSAO		VARCHAR2(12)		DEFAULT '1' NULL ,
   NRORGULTATU		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERULTATU		VARCHAR2(12)		DEFAULT '1' NULL ,
	CONSTRAINT PK_GPE_ITEMPROCADMJUD PRIMARY KEY (NRITEMPROCADMJUD)
)
/
CREATE TABLE GPE_ABDECISAO
(
   NRABDECISAO		NUMBER			NOT NULL,
   DSABDECISAO		VARCHAR2(200)		NOT NULL,
   CDESOCIAL		VARCHAR2(2)		NOT NULL,
   NRORG                       		NUMBER              		DEFAULT 1 NOT NULL,
   IDATIVO			VARCHAR2(1)		DEFAULT 'S' NOT NULL
  	CONSTRAINT CKC_IDATIVO_ABDECISAO CHECK (IDATIVO IN ('N','S')),
   DTINCLUSAO		DATE			DEFAULT SYSDATE NOT NULL,
   DTULTATU		DATE			NULL,
   NRORGINCLUSAO		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERINCLUSAO		VARCHAR2(12)		DEFAULT '1' NULL ,
   NRORGULTATU		NUMBER(22)		DEFAULT 1 NULL ,
   CDOPERULTATU		VARCHAR2(12)		DEFAULT '1' NULL ,
   	CONSTRAINT PK_GPE_ABDECISAO PRIMARY KEY (NRABDECISAO)
)
/
ALTER TABLE GPE_PROCESSADMJUD
	ADD CONSTRAINT FKHCM00033_MATEPROCADJU FOREIGN KEY (NRMATERPROCADJU)
		REFERENCES GPE_MATEPROCADJU (NRMATERPROCADJU)
/
ALTER TABLE GPE_ITEMPROCADMJUD
	ADD CONSTRAINT FKHCM00034_SUSPEXIG FOREIGN KEY (NRSUSPEXIGITPROC)
		REFERENCES GPE_SUSPEXIGITPROC (NRSUSPEXIGITPROC)
/
ALTER TABLE GPE_ITEMPROCADMJUD ADD NRABDECISAO NUMBER
/
ALTER TABLE GPE_ITEMPROCADMJUD
	ADD CONSTRAINT FKHCM00035_ABDECISAO FOREIGN KEY (NRABDECISAO)
		REFERENCES GPE_ABDECISAO (NRABDECISAO)