1
In the first select the BALANCE is coming zeroed, in the second I replace the sysdate by which would be the date it brings the correct value
what must be the problem in sysdate+4 in Where?
SELECT SYSDATE+4 DATA, (SELECT NVL(SUM(E1_SALDO),0) A
FROM PROTHEUS.SE1010
INNER JOIN PROTHEUS.SED010 ON ED_CODIGO=E1_NATUREZ
WHERE SE1010.D_E_L_E_T_<>'*' AND SED010.D_E_L_E_T_<>'*' AND E1_SALDO<>'0' AND (TO_DATE(E1_VENCREA, 'YYYYMMDD')) = (SYSDATE+4))A
FROM DUAL
SELECT SYSDATE+4 DATA, (SELECT NVL(SUM(E1_SALDO),0) A
FROM PROTHEUS.SE1010
INNER JOIN PROTHEUS.SED010 ON ED_CODIGO=E1_NATUREZ
WHERE SE1010.D_E_L_E_T_<>'*' AND SED010.D_E_L_E_T_<>'*' AND E1_SALDO<>'0' AND E1_VENCREA = ('20190924'))A
FROM DUAL
Or TO_DATE(E1_VENCREA, 'YYYYMMDD') = Trunc(SYSDATE+4)
– Motta
George, that was an ORA-01481 error. I followed your logic and got it like this: AND (TO_DATE(E1_VENCREA,'YYYYMMDD')) = (TO_DATE(TO_CHAR(SYSDATE+4, 'YYYYMMDD'),'YYYYMMDD'))A As Motta suggested it worked too Thank you very much gentlemen!!
– Jonathan Gomes
I think I’d kill the Totvs guy who decided to use string instead of date .... :)
– Motta