CREATE TABLE UTILPRATOSERV (
	NRUTILPRATOSERV 	NUMBER 														NOT NULL,
	NRVIGENCIA 			NUMBER 														NOT NULL,
	CDSERVFILI 			VARCHAR2(5) 												NOT NULL,
	NRGRUPOPRATOSERV 	NUMBER 														NOT NULL,
	IDUTILPRATOSERVSEG	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVSEG CHECK (IDUTILPRATOSERVSEG IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	IDUTILPRATOSERVTER 	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVTER CHECK (IDUTILPRATOSERVTER IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	IDUTILPRATOSERVQUA 	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVQUA CHECK (IDUTILPRATOSERVQUA IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	IDUTILPRATOSERVQUI 	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVQUI CHECK (IDUTILPRATOSERVQUI IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	IDUTILPRATOSERVSEX 	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVSEX CHECK (IDUTILPRATOSERVSEX IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	IDUTILPRATOSERVSAB 	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVSAB CHECK (IDUTILPRATOSERVSAB IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	IDUTILPRATOSERVDOM 	VARCHAR2(30) 	DEFAULT 'RESTRICAO' 						NOT NULL
		CONSTRAINT CKC_IDUTILPRATOSERVDOM CHECK (IDUTILPRATOSERVDOM IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO')),
	NRORG 				NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 	NOT NULL,
	IDATIVO 			VARCHAR2(1) 	DEFAULT 'S' 								NOT NULL
		CONSTRAINT CKC_IDATIVO_UTILPRATOSERV CHECK (IDATIVO IN ('S', 'N')),
	DTINCLUSAO 			DATE 														NULL,
	DTULTATU 			DATE 														NULL,
	NRORGINCLUSAO 		NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 	NULL,
	CDOPERINCLUSAO 		VARCHAR2(12) 	DEFAULT '1' 								NULL,
	NRORGULTATU 		NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')	NULL,
	CDOPERULTATU 		VARCHAR2(12)	DEFAULT '1' 								NULL,
	CONSTRAINT PK_UTILPRATOSERV PRIMARY KEY (NRUTILPRATOSERV)
)
/
ALTER TABLE UTILPRATOSERV ADD
	CONSTRAINT FKPLA01152VIGUTILPRATOSERV FOREIGN KEY (NRVIGENCIA)
		REFERENCES VIGUTILPRATOSERV (NRVIGENCIA)
/
CREATE INDEX FKPLA01152VIGUTILPRATOSERV ON UTILPRATOSERV (NRVIGENCIA)
/
ALTER TABLE UTILPRATOSERV ADD
	CONSTRAINT FKPLA01153GRUPOPRATOSERV FOREIGN KEY (NRGRUPOPRATOSERV)
		REFERENCES GRUPOPRATOSERV (NRGRUPOPRATOSERV)
/
CREATE INDEX FKPLA01153GRUPOPRATOSERV ON UTILPRATOSERV (NRGRUPOPRATOSERV)