CREATE TABLE CONTROLEPEDIDOS (
   CDFILIAL          VARCHAR2(4)   	 NOT NULL,   
   NRVENDAREST       VARCHAR2(10)  	 NOT NULL,
   NRCOMANDA         VARCHAR2(10)  	 NOT NULL,
   CDLOJA            VARCHAR2(10)  	 NULL,
   NRSEQHISTPED      VARCHAR2(3)     NOT NULL,
   IDSTATUSENVIO     VARCHAR2(1)     DEFAULT 'N'								NOT NULL,
   DSSTATUSENVIO     VARCHAR2(2000)  NULL,
   CDSUBPROJETO      VARCHAR2(3)  	 NOT NULL,
   NRORG             NUMBER 	     DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
   DTINCLUSAO        DATE            DEFAULT SYSDATE,
   DTULTATU          DATE            DEFAULT SYSDATE,
   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 CKC_IDATIVO_CONTROLEPEDIDOS CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_CONTROLEPEDIDOS PRIMARY KEY (CDFILIAL, NRVENDAREST, NRCOMANDA, CDSUBPROJETO, NRSEQHISTPED)
)
/

CREATE TABLE CONTROLEVENDAS (
   CDFILIAL          VARCHAR2(4)   	 NOT NULL,   
   NRSEQVENDA        VARCHAR2(10)  	 NOT NULL,
   CDCAIXA           VARCHAR2(3)  	 NOT NULL,
   CDLOJA            VARCHAR2(10)  	 NULL,
   IDSTATUSENVIO     VARCHAR2(1)     DEFAULT 'N'								NOT NULL,
   DSSTATUSENVIO     VARCHAR2(2000)  NULL,
   CDSUBPROJETO      VARCHAR2(3)  	 NOT NULL,
   NRORG             NUMBER 	     DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
   DTINCLUSAO        DATE            DEFAULT SYSDATE,
   DTULTATU          DATE            DEFAULT SYSDATE,
   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 CKC_IDATIVO_CONTROLEVENDAS CHECK (IDATIVO IN ('S','N')),
      CONSTRAINT PK_CONTROLEVENDAS PRIMARY KEY (CDFILIAL, NRSEQVENDA, CDCAIXA, CDSUBPROJETO)
)
/

ALTER TABLE CADASTROSUBPROJETO ADD WEBHOOKURL VARCHAR2(1000)
/

ALTER TABLE CADASTROSUBPROJETO ADD WEBHOOKURLAUX VARCHAR2(1000)
/