CREATE TABLE UF_DECLARACAO 
(
   DECLARACAO         VARCHAR2(50)    NOT NULL,
	SGESTADO          VARCHAR2(2)     NOT NULL, 
	CDESTADO          VARCHAR2(2)     NOT NULL, 
	NMESTADO          VARCHAR2(30)    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_UF_DECLARACAO CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_UF_DECLARACAO PRIMARY KEY (DECLARACAO, SGESTADO),
        CONSTRAINT UF_DECLARACAO_01 UNIQUE (DECLARACAO, CDESTADO)
)
/

INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'AC', '01', 'Acre', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'AL', '02', 'Alagoas', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')  
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'AP', '03', 'Amapa', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'AM', '04', 'Amazonas', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'BA', '05', 'Bahia', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'CE', '06', 'Ceara', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'DF', '07', 'Distrito Federal', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'ES', '08', 'Espirito Santo', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'GO', '10', 'Goias', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'MA', '12', 'Maranhao', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'MT', '13', 'Mato Grosso', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'MG', '14', 'Minas Gerais', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'PA', '15', 'Para', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'PB', '16', 'Paraiba', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'PR', '17', 'Parana', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'PE', '18', 'Pernambuco', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'PI', '19', 'Piaui', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'RN', '20', 'Rio Grande do Norte', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'RS', '21', 'Rio Grande do Sul', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'RJ', '22', 'Rio de Janeiro', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'RO', '23', 'Rondonia', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'RR', '24', 'Roraima', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'SC', '25', 'Santa Catarina', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'SP', '26', 'Sao Paulo', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'SE', '27', 'Sergipe', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'MS', '28', 'Mato Grosso do Sul', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'TO', '29', 'Tocantins', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/
INSERT INTO UF_DECLARACAO (DECLARACAO, SGESTADO, CDESTADO, NMESTADO, NRORG, IDATIVO, DTINCLUSAO, DTULTATU, NRORGINCLUSAO, CDOPERINCLUSAO, NRORGULTATU, CDOPERULTATU) VALUES ('DIF TO', 'XX', '90', 'Exterior', SYS_CONTEXT('nrorg_ctx','nrorg'), 'S', SYSDATE, SYSDATE, SYS_CONTEXT('nrorg_ctx','nrorg'), '1', SYS_CONTEXT('nrorg_ctx','nrorg'), '1')
/