CREATE TABLE IMPALIQCONTAB (
  CDIMPOSTO 	VARCHAR2(02) 	NOT NULL,
  VRALIQUOTA 	FLOAT	                   	NOT NULL,
  CDCCTBLDESP     	VARCHAR2(20)             NULL,
  CDCCTBLPASS     	VARCHAR2(20)             NULL,
  CDCCTBLATIV     	VARCHAR2(20)             NULL,
  CDCCTBLDADM     	VARCHAR2(20)             NULL,
   NRORG                       	NUMBER DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_IMPALIQCONTAB  CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO             DATE                   	NULL,
   DTULTATU                  	DATE                  	NULL,
   NRORGINCLUSAO    NUMBER            	DEFAULT 1 NULL,
   CDOPERINCLUSAO  VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          NUMBER             	DEFAULT 1 NULL,
   CDOPERULTATU        VARCHAR2(12)  	DEFAULT '1',
   	CONSTRAINT PK_IMPALIQCONTAB PRIMARY KEY (CDIMPOSTO, VRALIQUOTA)
)
/
 
ALTER TABLE IMPALIQCONTAB 
	ADD CONSTRAINT FKCTB00302IMPOSTO  FOREIGN KEY (CDIMPOSTO)
      		REFERENCES IMPOSTO (CDIMPOSTO)
/

CREATE INDEX FK_CTB00302 ON IMPALIQCONTAB (CDIMPOSTO)
/

ALTER TABLE BAIXAPAGA ADD NRSEQCOMPREL NUMBER NULL
/

ALTER TABLE BAIXAPAGA ADD IDBAIXIMPR VARCHAR2(01) DEFAULT 'N' NOT NULL
         CONSTRAINT CKC_IDBAIXIMPRBAIXA CHECK (IDBAIXIMPR IN ('S', 'N')) 
/