Ver Mensaje Individual
  #25  
Antiguo 18-09-2004
aurafern aurafern is offline
Miembro
 
Registrado: dic 2003
Posts: 34
Reputación: 0
aurafern Va por buen camino
Nota: al parametro pfecha lo cambie de tipo y tamaño por varchar(100), para no mandarle solo la fecha, sino la cadena

' and ('09/09/2004' - d.vencimiento) '

La sentencia SQL así

Código SQL [-]
SELECT SUM(e.DEBITO-e.CREDITO) AS SALDO, e.ID_AUXILIAR,e.ID_EMPRESA_CRUCE, e.ID_SUCURSAL_CRUCE,e.ID_TIPO_DOC_CRUCE, e.numero_cruce, E.CUOTA_CRUCE,
d.fecha, d.vencimiento,e.id_tercero,e.ID_SUCURSAL_TERCERO, E.ID_VENDEDOR FROM CUENTAS_POR_TERCERO e , cuentas_por_tercero d
where e.ID_EMPRESA_CRUCE=d.ID_EMPRESA and e.ID_SUCURSAL_CRUCE=d.ID_SUCURSAL AND E.CUOTA_CRUCE=D.CUOTA
and e.ID_TIPO_DOC_CRUCE= d.id_tipo_doc and e.numero_cruce=d.numero  AND e.ID_EMPRESA = 1  AND E.ID_SUCURSAL=1
and e.id_tercero =1 AND E.ID_VENDEDOR=1 AND E.ID_SUC_VENDEDOR=1
and e.id_sucursal_tercero=1   and e.id_auxiliar =13050501
and ('09/09/2004' - d.vencimiento)>= 30 and ('09/09/2004' - d.vencimiento)<= 90
GROUP BY e.ID_AUXILIAR,e.ID_EMPRESA_CRUCE, e.ID_SUCURSAL_CRUCE,e.ID_TIPO_DOC_CRUCE,
e.numero_cruce, E.CUOTA_CRUCE , d.fecha, d.vencimiento,e.id_tercero,e.ID_SUCURSAL_TERCERO, E.ID_VENDEDOR
having SUM(e.DEBITO-e.CREDITO)<>0

funciona perfectamente

Si lo ejecuto paso a paso por el IBAdmin4, la cadena SQL_INS es exactamente igual a la consulta que muestro arriba, es decir, pienso que esta bien construida, pero arroja error al momento de llamar a la sentencia

Código SQL [-]
FOR EXECUTE STATEMENT SQL_INS
into :saldo,:id_auxiliar,:id_empresa,:id_sucursal,:id_tipo,:numero,:cuota,:fecha_DOC,:vencimiento,:id_ter  cero,:id_sucursal_tercero, :ID_VENDEDOR


Access Violation at address 007CCAA4 in module "IBAdmin.exe" .......

lo que pienso es que talvez este programa no soporta la instrucción.

pero
en el IBConsole hago el siguiente llamado

Código SQL [-]
SELECT * FROM cartera_proveedores_cadena(' ',' ',4,4,' and ('09/09/2004' - d.vencimiento) ',' ',' ',' ',' ',' ',' ')

Error:

ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 62
09

Código SQL [-]

SELECT * FROM cartera_proveedores_cadena(" "," ",4,4," and ('09/09/2004' - d.vencimiento) "," "," "," "," "," "," ")

Error

ISC ERROR MESSAGE:
Dynamic SQL Error
expression evaluation not supported

Código SQL [-]

SELECT * FROM cartera_proveedores_cadena(" "," ",4,4," and (cast('09/09/2004' as date) - d.vencimiento) "," "," "," "," "," "," ")

ISC ERROR MESSAGE:
expression evaluation not supported

STATEMENT:
TIBOInternalDataset: "<TApplication>.frmMain.dlgWisql.<TIBOQuery>.<TIBOInternalDataset>."

quito lo del filtro de fechas y tambien funciona en el IBconsole

Código SQL [-]
SELECT SUM(e.DEBITO-e.CREDITO) AS SALDO, e.ID_AUXILIAR,e.ID_EMPRESA_CRUCE, e.ID_SUCURSAL_CRUCE,e.ID_TIPO_DOC_CRUCE, e.numero_cruce, E.CUOTA_CRUCE,
d.fecha, d.vencimiento,e.id_tercero,e.ID_SUCURSAL_TERCERO, E.ID_VENDEDOR FROM CUENTAS_POR_TERCERO e , cuentas_por_tercero d
where e.ID_EMPRESA_CRUCE=d.ID_EMPRESA and e.ID_SUCURSAL_CRUCE=d.ID_SUCURSAL AND E.CUOTA_CRUCE=D.CUOTA
and e.ID_TIPO_DOC_CRUCE= d.id_tipo_doc and e.numero_cruce=d.numero  AND e.ID_EMPRESA = 1  AND E.ID_SUCURSAL=1
and e.id_tercero =1 AND E.ID_VENDEDOR=1 AND E.ID_SUC_VENDEDOR=1
and e.id_sucursal_tercero=1   and e.id_auxiliar =13050501
GROUP BY e.ID_AUXILIAR,e.ID_EMPRESA_CRUCE, e.ID_SUCURSAL_CRUCE,e.ID_TIPO_DOC_CRUCE,
e.numero_cruce, E.CUOTA_CRUCE , d.fecha, d.vencimiento,e.id_tercero,e.ID_SUCURSAL_TERCERO, E.ID_VENDEDOR
having SUM(e.DEBITO-e.CREDITO)<>0

respectivamente construyo exactamente esta misma cadena en el SP y lo llamo desde el ibconsole


Código SQL [-]

SELECT * FROM cartera_proveedores_cadena(" "," ",4,4," and (cast('09/09/2004' as date) - d.vencimiento) "," "," "," "," "," "," ")

O

Código SQL [-]

SELECT * FROM cartera_proveedores_cadena(' ',' ',4,4,' and ('09/09/2004' - d.vencimiento) ',' ',' ',' ',' ',' ',' ')

y arroja
ISC ERROR MESSAGE:
Variable type (position 6) in EXECUTE STATEMENT 'SELECT SUM(e.DEBITO-e.CREDITO) AS SALDO, e.ID_AUXI' INTO does not match return

No he podido con esto!!
Responder Con Cita