Good afternoon. I am having trouble in a database query. Performing this returns this error:
ORA-01722: número inválido
01722. 00000 - "invalid number"
*Cause: The specified number was invalid.
*Action: Specify a valid number.
My code:
SELECT T2.ID_EMPRESA, T2.ID_EQUIPAMENTO, T1.ID_OBRA, T1.ID_ATIVIDADE, SUM(T1.KM_FINAL - T1.KM_INICIAL) AS DIFERENCA_KMS
FROM CE_REGISTRO_LEVES T1
INNER JOIN CE_BOLETIM T2 ON T2.ID = T1.ID_BOLETIM AND T2.DATA BETWEEN TO_DATE('01/06/2018', 'DD/MM/YYYY') AND TO_DATE('30/06/2018', 'DD/MM/YYYY')
WHERE CASE WHEN T1.ID_OBRA = '82' AND T1.ID_ATIVIDADE = '12' THEN 0 ELSE 1 END = 1
GROUP BY T2.ID_EMPRESA, T2.ID_EQUIPAMENTO, T1.ID_OBRA, T1.ID_ATIVIDADE
ORDER BY T2.ID_EQUIPAMENTO
Can anyone help me? Thank you.