I have the below simple select query in oracle.
SELECT
HN.HAND_PERSON_NOTIFICATIONS_GUID,
HN.NOTIFICATION_TEXT,
HN.NOTIFICATION_TYPE,
HN.NOTIFICATION_DATE,
TO_CHAR(HN.CREATE_DATE,'dd-MM-yyyy') AS CREATE_DATE,
TO_CHAR(HN.CHANGE_DATE,'dd-MM-yyyy') AS CHANGE_DATE,
TO_CHAR(HN.REG_DATE,'dd-MM-yyyy') AS REG_DATE,
LU.INIT AS INIT,
IX.PNR AS CPR,
IX.NAVN AS FULLNAME
FROM HAND_PERSON_NOTIFICATIONS HN, LM_USER LU, HAND_PERSON_INFO HI, INDIVID_X IX
WHERE HN.HAND_PERSON_INFO_GUID = HI.HAND_PERSON_INFO_GUID
AND HN.REG_USER_GUID = LU.LM_USER_GUID
AND HI.CPR = IX.PNR
AND HI.HAND_PERSON_INFO_GUID = 'd274579c-3132-485e-a3ea-d5b540c19faf'
AND HN.NOTIFICATION_TYPE = 'fsfsfs'
AND TO_DATE(HN.NOTIFICATION_DATE, 'DD-MM-YYYY') BETWEEN TO_DATE('21-07-2022', 'DD-MM-YYYY') AND TO_DATE('21-07-2022, 'DD-MM-YYYY')
ORDER BY HN.CREATE_DATE DESC
But when I run the query I get the below error:
ORA-00907: manglende højre parentes 00907. 00000 - "missing right parenthesis" *Cause:
*Action: Error at Line: 18 Column: 119
Please be informed that the column type of HN.NOTIFICATION_DATE is Date. Can anyone let me know where the problem is?
CodePudding user response:
You are missing the right parenthesis on AND TO_DATE('21-07-2022 ,, 'DD-MM-YYYY')
Try the following query:
SELECT
HN.HAND_PERSON_NOTIFICATIONS_GUID,
HN.NOTIFICATION_TEXT,
HN.NOTIFICATION_TYPE,
HN.NOTIFICATION_DATE,
TO_CHAR(HN.CREATE_DATE,'dd-MM-yyyy') AS CREATE_DATE,
TO_CHAR(HN.CHANGE_DATE,'dd-MM-yyyy') AS CHANGE_DATE,
TO_CHAR(HN.REG_DATE,'dd-MM-yyyy') AS REG_DATE,
LU.INIT AS INIT,
IX.PNR AS CPR,
IX.NAVN AS FULLNAME
FROM HAND_PERSON_NOTIFICATIONS HN, LM_USER LU, HAND_PERSON_INFO HI, INDIVID_X IX
WHERE HN.HAND_PERSON_INFO_GUID = HI.HAND_PERSON_INFO_GUID
AND HN.REG_USER_GUID = LU.LM_USER_GUID
AND HI.CPR = IX.PNR
AND HI.HAND_PERSON_INFO_GUID = 'd274579c-3132-485e-a3ea-d5b540c19faf'
AND HN.NOTIFICATION_TYPE = 'fsfsfs'
AND TO_DATE(HN.NOTIFICATION_DATE, 'DD-MM-YYYY') BETWEEN TO_DATE('21-07-2022', 'DD-MM-YYYY') AND TO_DATE('21-07-2022', 'DD-MM-YYYY')
ORDER BY HN.CREATE_DATE DESC