ALTER TABLE CLIENTE
ADD USR_DSAPELIDO VARCHAR2(10)
/

ALTER TABLE CLIENTE
ADD USR_DTEXPOCLIE DATE
/

CREATE INDEX USR_CLIENTE_01 ON CLIENTE (USR_DSAPELIDO DESC)
/

ALTER TABLE FORNECEDOR
ADD USR_DSAPELIDO VARCHAR2(15)
/

ALTER TABLE FORNECEDOR
ADD USR_DTEXPOFORN DATE
/

CREATE INDEX USR_FORNECEDOR_01 ON FORNECEDOR (USR_DSAPELIDO DESC)
/

ALTER TABLE INSCRESTAD
ADD USR_IDINSCATIV VARCHAR2(01)
/

ALTER TABLE INSCRESTAD
ADD USR_LUCRPRES VARCHAR2(01)
/

UPDATE INSCRESTAD
SET USR_IDINSCATIV = 'S',
    USR_LUCRPRES = 'S'
WHERE CDEMPRESA = '01'
  AND CDINSCESTA = '492348128119'
/

CREATE TABLE USR_TCONDPAGTO
(CODCPG     NUMBER NOT NULL,
 PRIMEIRA   VARCHAR2(01) NOT NULL,
 DESCPG     VARCHAR2(50) NOT NULL,
 NUMPAR     NUMBER NOT NULL,
 DIASEMI    NUMBER NOT NULL,
 CHAVE      NUMBER NOT NULL,
 PCEMISSAO  FLOAT  NOT NULL,
 CP_PRAZO   VARCHAR2(04) NOT NULL,
 CONSTRAINT PK_TCONDPAGTO PRIMARY KEY (CODCPG)
)
/

ALTER TABLE FORMPGTO
ADD USR_CODCPG NUMBER
/

CREATE TABLE USR_PESTADO
(EST_CODIGO VARCHAR2(02) NOT NULL,
 EST_CODUSU NUMBER,
 EST_ICMS   FLOAT,
 EST_ICMSIE FLOAT,
 EST_NOME   VARCHAR2(30),
 EST_REGIAO VARCHAR2(20),
    CONSTRAINT PK_PESTADO PRIMARY KEY (EST_CODIGO))
/

CREATE TABLE USR_FCREDITOPISCOFINS
(CPC_CATEGORIA    VARCHAR2(20) NOT NULL,
 CPC_FJ           VARCHAR2(01) NOT NULL,
 CPC_ALIQPIS      FLOAT        NOT NULL,
 CPC_ALIQCOFINS   FLOAT        NOT NULL,
    CONSTRAINT PK_FCREDITOPISCOFINS PRIMARY KEY (CPC_CATEGORIA))
/

CREATE TABLE USR_PINDICEICMS
(II_CODEST  VARCHAR2(02) NOT NULL,
 II_CODPRO  VARCHAR2(15) NOT NULL,
 II_INDICE  FLOAT,
 II_BASE    FLOAT,
 II_CFOP    VARCHAR2(07),
    CONSTRAINT PK_PINDICEICMS PRIMARY KEY (II_CODEST, II_CODPRO))
/

CREATE TABLE USR_TSAPORE_16
(T16_ESTAORIG VARCHAR2(02) NOT NULL,
 T16_ESTADEST VARCHAR2(02) NOT NULL,
 T16_ALIQUOTA FLOAT,
 DTULTATUT16  DATE,
    CONSTRAINT PK_TSAPORE_16 PRIMARY KEY (T16_ESTAORIG, T16_ESTADEST))
/

CREATE TABLE USR_PPRODUTO
(PRO_CODIGO      NUMBER NOT NULL,
 PRO_CREDITOICMS VARCHAR2(01) NOT NULL,
    CONSTRAINT PK_USR_PPRODUTO PRIMARY KEY (PRO_CODIGO))
/

ALTER TABLE USR_PPRODUTO
ADD PRO_CREDITOPIS VARCHAR2(01)
/

ALTER TABLE PRODUTO
ADD USR_DTEXPORTACAO DATE
/

ALTER TABLE PARAMGERAL
DROP CONSTRAINT CKC_11213454
/

ALTER TABLE PARAMGERAL
ADD CONSTRAINT CKC_11213454 check (IDSISDOS is null or (IDSISDOS in ('1','2','3','4')))
/

UPDATE PARAMGERAL
SET IDSISDOS = '4'
/

COMMIT
/
