0
When I run the direct query in Oracle returns correct, but when I do via Intelij/java, returns the error: ORA-01846: it is not a valid day of the week.
SELECT analog,DEVTYP, trunc(data), Max(dis)dis
FROM table a, table b
WHERE a.table_index = b.table_index
AND
b.substn = 'valor1'
AND b.DEVTYP = 'valor2'
and
b.analog = 'valor3'
AND
-- CONDITION FOR LAST THREE FRIDAYS
TRUNC(data) IN (
TRUNC(NEXT_DAY(SYSDATE - 8,'WED')),
TRUNC(NEXT_DAY(SYSDATE - 15,'WED')),
TRUNC(NEXT_DAY(SYSDATE - 22,'WED'))
)
-- CONDITION FOR 12 TO 18 HOURS
AND data - TRUNC(data) BETWEEN 12/24 and 18/24
GROUP BY trunc(data), analog,DEVTYP
The good thing is to always be in "ingrés", everything in general works , I found this treaty to solve this. https://community.oracle.com/thread/4023654?start=15&tstart=0
– Motta
TRUNC(NEXT_DAY(SYSDATE - 8,4)), tb worked here in my version
– Motta
Thank you! I changed my code in java to inform "Mon", "Ter", ..... for the days of the week, and then it worked.
– Jovani