CREATE TABLE PTO_BANCOHORASADMI 
(  NRBANCOHORASADM 	NUMBER 		NOT NULL,    
   NRTIPOVINCULOM 	NUMBER 		NOT NULL,    	
   NRBANCOHORAS 	NUMBER 		NOT NULL, 
   NRORG                		NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
   IDATIVO              		VARCHAR2(1)	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_PTO_BANCHRSADMI 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_PTO_BANCOHORASADMI PRIMARY KEY (NRBANCOHORASADM)
)
/
CREATE INDEX  HCM00053_FK ON PTO_BANCOHORASADMI (NRTIPOVINCULOM)
/
CREATE INDEX HCM00054_FK ON PTO_BANCOHORASADMI (NRBANCOHORAS)
/
CREATE TABLE PTO_OCORRENCIADMISSAO
   (
   NROCORRENCIADMISSAO 	NUMBER 		NOT NULL, 
   NRTIPOPROGOCORRENCIA NUMBER		NOT NULL,
   NRTIPOVINCULOM 	NUMBER 		NOT NULL,    		
   NRORG                		NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO              		VARCHAR2(1)	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_PTO_OCORADMIS 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 PTO_OCORRENCIADMISSAO PRIMARY KEY (NROCORRENCIADMISSAO)
)
/
CREATE INDEX  HCM00055_FK ON PTO_OCORRENCIADMISSAO (NRTIPOVINCULOM)
/
CREATE INDEX HCM00056_FK ON PTO_OCORRENCIADMISSAO (NRTIPOPROGOCORRENCIA)
/
ALTER TABLE PTO_BANCOHORASADMI ADD
	CONSTRAINT FKHCM00053GPE_TIPOVINCULOM FOREIGN KEY (NRTIPOVINCULOM)
		REFERENCES GPE_TIPOVINCULOM (NRTIPOVINCULOM)
/
ALTER TABLE PTO_BANCOHORASADMI ADD
	CONSTRAINT FKHCM00054PTO_BANCOHORAS FOREIGN KEY (NRBANCOHORAS)
		REFERENCES PTO_BANCOHORAS (NRBANCOHORAS)
/
ALTER TABLE PTO_OCORRENCIADMISSAO ADD
	CONSTRAINT FKHCM00055GPE_TIPOVINCULOM FOREIGN KEY (NRTIPOVINCULOM)
		REFERENCES GPE_TIPOVINCULOM (NRTIPOVINCULOM)
/
ALTER TABLE PTO_OCORRENCIADMISSAO ADD
	CONSTRAINT FKHCM00056PTO_TPPROGOCORR FOREIGN KEY (NRTIPOPROGOCORRENCIA)
		REFERENCES PTO_TIPOPROGOCORRENCIA (NRTIPOPROGOCORRENCIA)