I'm running a query on my sqlDeveloper and it throws me the correct result >>24 piezas
.
When I transport this query to java, it throws me a different number of pieces >>39
Here my code:
$_Query = "select sum(nvl(ln.cantidad,0)) ACUSES_ENTREGADOS "
+ " FROM xxqp.xxqp_rec_diario_tbl rd, "
+ " xxqp.xxqp_diario_hd_tbl hdr, "
+ " xxqp.xxqp_diario_ln_tbl ln "
+ " WHERE 1 = 1 "
+ " AND rd.diario_id = hdr.diario_id "
+ " AND hdr.diario_id = ln.diario_id "
+ " AND ln.codigo IS NOT NULL "
+ " AND LN.ESTATUS=11 "
+ " AND ln.csc_id = rd.csc_id "
+ " AND XXQP.XXQP_COMPROBANTE_DIARIO_PKG.XXQP_CATEGORIA_LINEA_DIARIO(Pni_diario_id => rd.diario_id "
+ " ,Pni_csc_id => ln.csc_id "
+ " ,Pni_pieza_id => Ln.pieza_id) = 'Acuses' "
+ " AND TO_CHAR(hdr.FECHA_CIERRE_DIARIO,'DD/MM/YYYY')='13/09/2016' "
+ " AND hdr.COLABORADOR_ID='108977'";
clon = Gdr.getCon(2);
st1 = clon.createStatement();
rs1 = st1.executeQuery($_Query);
while (rs1.next()) {
acusesEntregados = rs1.getInt("acuses_entregados");
if (r == 0) {%>
<tr bgcolor='white' ALIGN='CENTER'>
<%
r = 1;
} else {
r = 0;
%>
<tr bgcolor='#E6E6E6' ALIGN='CENTER'>
<%
}%>
<td><%=acusesEntregados%></td>
I suspect that you are not respecting this line of the query:
AND XXQP.XXQP_COMPROBANTE_DIARIO_PKG.XXQP_CATEGORIA_LINEA_DIARIO(Pni_diario_id => rd.diario_id
,Pni_csc_id => ln.csc_id
,Pni_pieza_id => Ln.pieza_id) = 'Acuses'
I do not know if I have to enter some configuration or have to modify the code.