I am getting the following error on the oracle query below. I'm not seeing an issue with the format that I am giving in the query. I'm thinking it might have something to do with the .SSS but I can't be certain:
SELECT
*
FROM
(
SELECT
*
FROM
comprater_requests
WHERE
spname =?
AND effectivedate >= TO_DATE(?,'yyyy-MM-dd HH:mi:ss.SSS')
AND effectivedate <= TO_DATE(?,'yyyy-MM-dd HH:mi:ss.SSS')
)
WHERE
ROWNUM <= 100
Error:
ORA-01810: format code appears twice
Parameters:
Parameters: [Google, 2018-07-24 00:00:00.000, 2018-09-06 00:00:00.000]
Table:
CREATE TABLE COMPRATER_REQUESTS
(
ID NUMBER DEFAULT COMP_RATER_SEQ.NEXTVAL PRIMARY KEY,
TRANSACTIONID VARCHAR2(20 BYTE) NOT NULL,
QUOTE CLOB,
ARCHIVEXML CLOB,
ADDITIONALINFO CLOB,
QUOTEID VARCHAR2(20 BYTE),
AGENTID CHAR(50 BYTE),
EFFECTIVEDATE DATE
);
The user selects two dates from the UI which is sent to the back end code in the following format 'Tue Sep 04 00:00:00 EDT 2018' but the oracle DB has the dates stored as '2018-09-04 00:00:00.0'. So I tried converting the date they select to that format by doing:
dateFormat = new SimpleDateFormat(CompRaterPropertiesML.ACORD_DB_DATE_FORMAT)
fromDateFormat = dateFormat.format(selectedDate1)
toDateFormat = dateFormat.format(selectedDate2)
This converts it to the format I need but it is now a string which I believe is giving me the issue.