Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General »

Consulta en DB2 pierde datos al cambiar el numero de registros

Estas en el tema de Consulta en DB2 pierde datos al cambiar el numero de registros en el foro de Bases de Datos General en Foros del Web. Hola amigos, tengo el siguiente problema; tengo una base de datos en db2 la cual se compone de tablas tales como; pedidos, cliente, sucursal, empleado.... ...
  #1 (permalink)  
Antiguo 06/07/2011, 00:56
 
Fecha de Ingreso: diciembre-2007
Mensajes: 385
Antigüedad: 16 años, 4 meses
Puntos: 0
Consulta en DB2 pierde datos al cambiar el numero de registros

Hola amigos, tengo el siguiente problema; tengo una base de datos en db2 la cual se compone de tablas tales como; pedidos, cliente, sucursal, empleado.... entre otras, y tengo una consulta la cual me trae los datos desde todas estas tablas, es decir de que cliente hizo el pedido el empleado que lo registro y en la sucursal en la cual fue realizado, la consulta es la siguiente:

CODIGO
------------------------
select DB2APP.trcabe.TCPEDO as Pedido,DB2APP.trcabe.TCPEDP, 'Id procesado:' || DB2APP.trcabe.TCPEDP as mensajePEDP,DB2APP.trpedi.TPDES as Tipo,DB2APP.TRORIG.ORPDES as Origen,DB2APP.trcabe.TCCLIE as Cliente,DB2APP.trcabe.TCCLIE, ' Rut:' || DB2APP.trcabe.TCRUT || '-' || DB2APP.trcabe.TCDV || ' Codigo: ' || DB2APP.trcabe.TCCLIE || ' Nombre:' || DB2APP.trcabe.TCRAZ as MsjCliente,case when DB2APP.trcabe.TCEPA1 = '1' then '~/Si.png' else '~/No.png' end as Pendiente,'Fecha/Hora: ' || DB2APP.trcabe.TCF400 || ' ' || DB2APP.trcabe.TCH400 as MsjPendiente,case when DB2APP.trcabe.TCFRET <> 0 then '~/Si.png' else '~/No.png' end as Retenido,'Fecha/Hora: ' || DB2APP.trcabe.TCFRET || ' ' || DB2APP.trcabe.TCHRET || '!, Usuario: ' || DB2APP.trcabe.TCURET as MsjRetenido,case when DB2APP.trcabe.TCFLIB <> 0 then '~/Si.png' else '~/No.png' end as Liberado,'Fecha/Hora: ' || DB2APP.trcabe.TCFLIB || ' ' || DB2APP.trcabe.TCHLIB || '!, Usuario: ' || DB2APP.trcabe.TCULIB as MsjLiberado,case when DB2APP.trcabe.TCFBOR <> 0 then '~/Si.png' else '~/No.png' end as Eliminado,'Fecha/Hora: ' || DB2APP.trcabe.TCFBOR || ' ' || DB2APP.trcabe.TCHBOR || '!, Usuario: ' || DB2APP.trcabe.TCUBOR as MsjEliminado,case when (DB2APP.trcabe.TCEMI2 = '4' or DB2APP.trcabe.TCEMI2 = '5') or (DB2APP.trcabe.TCEPA2 = '4' or DB2APP.trcabe.TCEPA2 = '5') or (DB2APP.trcabe.TCFCIR <> 0 and DB2APP.trcabe.TCHCIR <> 0) then '~/Si.png' else '~/No.png' end as Programado,case when (DB2APP.trcabe.TCEMI2 = '4') then ' PAC Parcial' when (DB2APP.trcabe.TCEMI2 = '5') then 'PAC Total' else '' end || ' Fecha/Hora: ' || DB2APP.trcabe.TCFMI2 || ' ' || DB2APP.trcabe.TCHMI2 || '!, Usuario: ' || DB2APP.trcabe.TCUMI2 || ', Carga: ' || DB2APP.trcabe.TCCMI2 as MsjProgramado1,case when (DB2APP.trcabe.TCEPA2 = '4') then ' MAPINFO Parcial' when (DB2APP.trcabe.TCEPA2 = '5') then 'MAPINFO Total' else '' end || ' Fecha/Hora: ' || DB2APP.trcabe.TCFPA2 || ' ' || DB2APP.trcabe.TCHPA2 || '!, Usuario: ' || DB2APP.trcabe.TCUPA2 || ', Carga: ' || DB2APP.trcabe.TCCAR2 as MsjProgramado2,case when (DB2APP.trcabe.TCFCIR is not null and DB2APP.trcabe.TCHCIR is not null) then ' CIR' else '' end || ' Fecha/Hora: ' || DB2APP.trcabe.TCFCIR || ' ' || DB2APP.trcabe.TCHCIR || '!, Usuario: ' || DB2APP.trcabe.TCUCIR || ', Carga: ' || DB2APP.trcabe.TCCCIR as MsjProgramado3,case when DB2APP.trcabe.TCFOE6 <> 0 then '~/Si.png' else '~/No.png' end as Procesado,'Fecha/Hora: ' || DB2APP.trcabe.TCFOE6 || ' ' || DB2APP.trcabe.TCHOE6 || '!, Usuario: ' || DB2APP.trcabe.TCUOE6 as MsjProcesado,case when DB2APP.trcabe.TCFFAC <> 0 then '~/Si.png' else '~/No.png' end as Facturado,'Nro. Basis: ' || DB2APP.trcabe.TCTRBA || ' Fecha/Hora: ' || DB2APP.trcabe.TCFFAC || ' ' || DB2APP.trcabe.TCHFAC || '!, Usuario: ' || DB2APP.trcabe.TCUFAC as MsjFacturado,case when DB2APP.trcabe.TCFENT <> 0 then '~/Si.png' else '~/No.png' end as Entregado,'Camion: ' || DB2APP.trcabe.TCCAMI || ' Viaje: ' || DB2APP.trcabe.TCVIAJ || 'Fecha/Hora: ' || DB2APP.trcabe.TCFENT || ' ' || DB2APP.trcabe.TCHENT as MsjEntregado,case when DB2APP.trcabe.TCFRTP <> 0 then '~/Si.png' else '~/No.png' end as Retornado,'Fecha/Hora: ' || DB2APP.trcabe.TCFRTP || ' ' || DB2APP.trcabe.TCHRTP || ' !,Código: ' || DB2APP.trcabe.RETCOD || ' Glosa: ' || 'La columna RETDES no Existe en amnbiente DEV' as MsjRetornado,case when DB2APP.trcabe.TCFLQD <> 0 then '~/Si.png' else '~/No.png' end as Liquidado, 'Fecha/Hora: ' || DB2APP.trcabe.TCFLQD || ' ' || DB2APP.trcabe.TCHLQD || '!, Usuario: ' || DB2APP.trcabe.TCULQD as MsjLiquidado from DB2APP.trcabe inner Join DB2APP.trpedi on DB2APP.trcabe.TPCOD = DB2APP.trpedi.TPCOD inner Join DB2APP.TRORIG on DB2APP.trcabe.ORPCOD = DB2APP.TRORIG.ORPCOD where ( DB2APP.trcabe.CPLAN = '10' OR 0=1) AND ( DB2APP.trcabe.CSUCU = '10' OR 0=1) AND (1=1) AND (1=1) AND ( (DB2APP.trcabe.TCEPA1 = '1' and TCFOE6=0) OR DB2APP.trcabe.TCFRET <> 0 OR DB2APP.trcabe.TCFLIB <> 0 OR DB2APP.trcabe.TCFBOR <> 0 OR (DB2APP.trcabe.TCEMI2 = '4' OR DB2APP.trcabe.TCEMI2 = '5') or (DB2APP.trcabe.TCEPA2 = '4' OR DB2APP.trcabe.TCEPA2 = '5') or (DB2APP.trcabe.TCFCIR <> 0 and DB2APP.trcabe.TCHCIR <> 0) OR DB2APP.trcabe.TCFOE6 <> 0 OR DB2APP.trcabe.TCFFAC <> 0 OR DB2APP.trcabe.TCFENT <> 0 OR DB2APP.trcabe.TCFRTP <> 0 OR DB2APP.trcabe.TCFLQD <> 0 OR 0=1) AND (DB2APP.trcabe.TCF400 >= '20110420') AND (DB2APP.trcabe.TCF400 <= '20110420') FETCH FIRST 100 ROWS ONLY
TERMINA CODIGO----------------------

el problema que ocurre es que cuando aumento el "100" del final a 100.000 por ejemplo o 1.000.000 ahi recien trae los 3 o 4 regitsros que hay en la base de datos. Esta consulta funciona la mayoria del tiempo bien, 1 de 100 consultas tiene problemas. Soy nuevo en db2 y llevo 2 dias en mi nuevo trabajo y me estan apurando al maximo para optimizar esta consulta, por mi parte creo q el problema esta en los inner join pero no estoy seguro, es por eso q recurro a uds para ver si me pueden guiar para asi poder optimizar esta consulta, se lo agradeceria muchisimo, de antemano gracias ... bye

Etiquetas: db2, numero, pierde, registros, tablas, bases-de-datos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:21.