CREATE TABLE GRUPOEMPR
(
CDGRUPEMPR 		VARCHAR2(3) NOT NULL,
DSGRUPEMPR  	VARCHAR2(30) NOT NULL,
NRORG 			NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
IDATIVO 		VARCHAR2(1) DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_GRUPOEMPR 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',
		CONSTRAINT PK_GRUPOEMPR PRIMARY KEY (CDGRUPEMPR)
)
/

ALTER TABLE EMPRESA ADD CDGRUPEMPR VARCHAR2(03)
/

CREATE TABLE PERFACESSGREMPR
(
NRPERFILACESSO 		NUMBER NOT NULL,
CDGRUPEMPR 			VARCHAR2(3) NOT NULL,
NRORG 				NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
IDATIVO 			VARCHAR2(1) DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_PERFACESSGREMPR 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',
		CONSTRAINT PK_PERFACESSGREMPR PRIMARY KEY (NRPERFILACESSO, CDGRUPEMPR)
)
/