I am currently writing some Code to get a view over issued service-tickets from my company and where they have been routed. I am using Birt for Eclipse to create a report who uses that Code. While using Toad 12.0.10.30, no exception is thrown, same for Birt. When uploading the Report to Maximo (IBM) and running the report there, I am getting a failed report with the Log file stating that
[ERROR] [MXQServer1] [] DataSet [Data_Set_Name] fetch failed:
java.sql.SQLDataException: ORA-01843: not a valid month
I tried Fixing up the REGEX of my date values and checking if everything should work and is, in fact, a date.
These are the parts of my Code that use Dates:
and trunc(creationdate) between to_date('01.01.2019', 'dd.MM.RRRR') and TRUNC(sysdate-1)
This part of the Code (Code is written with "with" blocks) issues a list of the months till yesterday, I Need that part for grouping later.
SELECT TO_CHAR ( ADD_MONTHS ( start_dt, LEVEL - 1), 'DD/MM/YYYY') AS monate
FROM (
SELECT TRUNC ( TO_DATE ( '01/01/2019', 'DD/MM/YYYY')) AS start_dt,
TRUNC ( sysdate-1) AS end_dt FROM dual
)
CONNECT BY LEVEL <= 1 + MONTHS_BETWEEN ( end_dt , start_dt)
This is how the report issued over Maximo is creating the sysdate:
2019-09-19 07:47:59.0
Could it be that, while running the report, the month is parsed wrong? Cause the sysdate is built different then my Formation (YYYY-MM-DD to DD/MM/YYYY). How would I be able to fix that?
Edit: While Running this Code "on Maximo"
SELECT VALUE FROM NLS_SESSION_PARAMETERS WHERE PARAMETER = 'NLS_DATE_FORMAT'
as suggested by user @MT0 I get
DD-MON-RR
as a return. With this in mind, is there a way to modify my Code to make it work as intended?