Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ingres@bioser060 ~]$ SQL -udba dbsev < teste.SQL | tee teste.log
- INGRES TERMINAL MONITOR Copyright 2011 Ingres Corporation
- Ingres Linux Version II 10.1.0 (a64.lnx/120)NPTL login
- Thu DEC 22 16:40:16 2011
- Enter \g TO EXECUTE commands, "help help\g" FOR help, \q TO quit
- continue
- * * /* SQL Startup File */
- help TABLE empresa_sistemas
- Executing . . .
- Name: empresa_sistemas
- Owner: dba
- Created: 21.12.2011 14:54:57
- Location: ii_database
- TYPE: USER TABLE
- Version: II10.0
- Page SIZE: 8192
- Cache priority: 0
- ALTER TABLE version: 0
- ALTER TABLE totwidth: 96
- ROW width: 96
- NUMBER OF ROWS: 80
- Storage STRUCTURE: btree WITH UNIQUE KEYS
- Compression: NONE
- Duplicate ROWS: NOT allowed
- NUMBER OF pages: 6
- Overflow DATA pages: 0
- Journaling: enabled after the NEXT checkpoint
- Base TABLE FOR VIEW: yes
- Permissions: yes
- Integrities: yes
- Optimizer statistics: NONE
- COLUMN Information:
- KEY
- COLUMN Name TYPE LENGTH NULLS Defaults Seq
- empresa INTEGER 2 no no 1
- cod_rg INTEGER 4 no no
- descricao VARCHAR 40 no no
- descr_empresa_reduzida CHAR 10 no no
- empr_patrim_cont INTEGER 2 no no
- empresa_consol INTEGER 2 no no
- serie_livro_saida CHAR 5 yes NULL
- aceita_aviso_lcto CHAR 1 no no
- aceita_cpc CHAR 1 no no
- aceita_boletim_ind CHAR 1 no no
- unidade_industrial INTEGER 2 no no
- empr_proman INTEGER 4 yes NULL
- cod_ramo_atividade INTEGER 4 yes NULL
- checa_imovel_fazenda CHAR 1 yes NULL
- cod_estab VARCHAR 6 yes NULL
- protocolo_gem CHAR 1 yes NULL
- Secondary indexes:
- INDEX Name STRUCTURE Keyed ON
- "$xpkempresa_sistemas" btree empresa
- continue
- * * * * * * * * *
- DECLARE global TEMPORARY TABLE SESSION.mov_ctb
- (empresa i2 NOT NULL,
- DATA DATE NOT NULL,
- nro_lcto i4 NOT NULL,
- origem_contabil c5 NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * * * * * *
- DECLARE global TEMPORARY TABLE SESSION.mov_contabil_det
- (origem_contabil CHAR(5) NOT NULL,
- empresa i2 NOT NULL,
- DATA DATE NOT NULL,
- nro_lcto i4 NOT NULL,
- sequencia i4 NOT NULL,
- empresa_lcto i2 NOT NULL,
- tipo_plano i4 NOT NULL,
- item_contabil i4 NOT NULL,
- tipo c1 NOT NULL,
- valor f8 NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * * * * * * *
- DECLARE global TEMPORARY TABLE SESSION.mov_contabil
- (empresa i2 NOT NULL,
- ano_mes VARCHAR(6) NOT NULL,
- nro_lcto i4 NOT NULL,
- origem_contabil c5 NOT NULL,
- sequencia i4 NOT NULL,
- tipo_plano i4 NOT NULL,
- item_contabil i4 NOT NULL,
- tipo CHAR(1) NOT NULL,
- DATA DATE NOT NULL,
- valor f8 NOT NULL,
- del_hist CHAR(1) NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * * *
- commit;
- Executing . . .
- continue
- * * * * *
- DECLARE global TEMPORARY TABLE SESSION.origem_contabil
- (origem_contabil CHAR(5) NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * * commit;
- Executing . . .
- continue
- * * * * * * *
- DECLARE global TEMPORARY TABLE SESSION.item_contabil
- (tipo_plano i1 NOT NULL,
- item_contabil i4 NOT NULL,
- tipo c1 NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * * * * * * * * * * * * *
- DECLARE global TEMPORARY TABLE SESSION.mov_contabil_detx
- (empresa i2 NOT NULL,
- DATA DATE NOT NULL,
- nro_lcto i4 NOT NULL,
- sequencia i4 NOT NULL,
- empresa_lcto i2 NOT NULL,
- tipo_plano i4 NOT NULL,
- item_contabil i4 NOT NULL,
- tipo c1 NOT NULL,
- valor f8 NOT NULL,
- nro_lcto_diario i4 NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * *
- INSERT INTO SESSION.mov_contabil_detx
- SELECT a.*
- FROM mov_contabil_det a,
- empresa_sistemas b
- WHERE a.empresa_lcto = b.empresa AND
- b.empresa_consol = 3 AND
- a.DATA > DATE('31.03.2007') - '1 year';
- Executing . . .
- (2860203 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * *
- DECLARE global TEMPORARY TABLE SESSION.item_contabilx
- (tipo_plano i1 NOT NULL,
- item_contabil i4 NOT NULL)
- ON commit preserve ROWS WITH norecovery;
- Executing . . .
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * *
- MODIFY SESSION.mov_contabil_detx TO btree UNIQUE ON
- empresa ,
- DATA ,
- nro_lcto ,
- sequencia;
- Executing . . .
- (2860203 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * *
- INSERT INTO SESSION.item_contabil
- SELECT b.tipo_plano ,
- b.item_contabil,
- c.tipo
- FROM item_contabil b,
- tipo_contabil c
- WHERE b.tipo_contabil = c.tipo_contabil AND
- (uppercase(c.tipo) = 'R');
- Executing . . .
- (3735 ROWS)
- continue
- * * commit;
- Executing . . .
- continue
- * * * * *
- MODIFY SESSION.item_contabil TO btree UNIQUE ON
- tipo_plano ,
- item_contabil;
- Executing . . .
- (3735 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * *
- INSERT INTO SESSION.origem_contabil
- SELECT DISTINCT origem_contabil
- FROM origem_contabil
- WHERE origem_contabil <> 'ENCBA';
- Executing . . .
- (71 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * *
- MODIFY SESSION.origem_contabil TO btree UNIQUE ON origem_contabil;
- Executing . . .
- (71 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * * * *
- INSERT INTO SESSION.mov_ctb
- SELECT a.empresa ,
- a.DATA ,
- a.nro_lcto ,
- a.origem_contabil
- FROM mov_contabil a,
- SESSION.origem_contabil b
- WHERE a.origem_contabil = b.origem_contabil AND
- (a.DATA > '31.03.2007' AND
- a.DATA <= '31.10.2010');
- Executing . . .
- (843071 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * *
- MODIFY SESSION.mov_ctb TO btree UNIQUE ON
- empresa ,
- DATA ,
- nro_lcto;
- Executing . . .
- (843071 ROWS)
- continue
- * * * * * * * *
- INSERT INTO SESSION.item_contabilx
- SELECT a.tipo_plano ,
- a.item_contabil
- FROM item_contabil a
- WHERE (a.item_contabil >= 1 AND
- a.item_contabil <= 9999999);
- Executing . . .
- (32524 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * *
- MODIFY SESSION.item_contabilx TO btree UNIQUE ON tipo_plano, item_contabil;
- Executing . . .
- (32524 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * * * * * * * * * * * * *
- INSERT INTO SESSION.mov_contabil_det
- SELECT a.origem_contabil,
- b.empresa ,
- b.DATA ,
- b.nro_lcto ,
- b.sequencia ,
- b.empresa_lcto ,
- b.tipo_plano ,
- b.item_contabil ,
- b.tipo ,
- b.valor
- FROM SESSION.mov_ctb a,
- SESSION.mov_contabil_detx b,
- SESSION.item_contabilx x
- WHERE a.empresa = b.empresa AND
- a.DATA = b.DATA AND
- a.nro_lcto = b.nro_lcto AND
- b.tipo_plano = x.tipo_plano AND
- b.item_contabil = x.item_contabil;
- Executing . . .
- (1200685 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * *
- MODIFY SESSION.mov_contabil_det TO btree UNIQUE ON empresa,
- DATA, nro_lcto, sequencia;
- Executing . . .
- (1200685 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * *
- MODIFY SESSION.mov_contabil_det TO btree ON
- empresa_lcto;
- Executing . . .
- (1200685 ROWS)
- continue
- * * *
- commit;
- Executing . . .
- continue
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /*
- select b.empresa ,
- varchar(date_part('year' , b.data )) + right('0' +
- varchar(date_part('month', b.data)) , 2 ),
- b.nro_lcto ,
- b.origem_contabil ,
- b.sequencia ,
- b.tipo_plano ,
- b.item_contabil ,
- b.tipo ,
- b.data ,
- b.valor ,
- 'N'
- from session.mov_contabil_det b,
- empresa_sistemas c
- where b.empresa_lcto = c.empresa and
- c.empresa_consol = 3;
- \p\g
- commit;
- \p\g
- */
- SELECT DISTINCT b.empresa_lcto, c.empresa
- FROM SESSION.mov_contabil_det b,
- empresa_sistemas c
- WHERE int2(b.empresa_lcto) = c.empresa AND
- c.empresa_consol = 3;
- Executing . . .
- commit;
- +------+------+
- |empres|empres|
- +------+------+
- | 1| 1|
- | 2| 2|
- | 3| 3|
- | 4| 4|
- | 8| 8|
- | 12| 12|
- | 13| 13|
- | 14| 14|
- | 43| 43|
- +------+------+
- (9 ROWS)
- continue
- * * * * * * * *
- SELECT DISTINCT b.empresa_lcto, c.empresa
- FROM SESSION.mov_contabil_det b,
- empresa_sistemas c
- WHERE b.empresa_lcto = c.empresa AND
- c.empresa_consol = 3;
- Executing . . .
- +------+------+
- |empres|empres|
- +------+------+
- | 43| 43|
- +------+------+
- (1 ROW)
- continue
- * * * * * * * * * * * * * * * * * * * * *
- Your SQL statement(s) have been committed.
- Ingres Version II 10.1.0 (a64.lnx/120)NPTL logout
- Thu DEC 22 16:41:51 2011
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement