Oracle RAC: 11.2.0.3.0
Nodes: 2
OS: Red Hat Linux 6.8
Problem: I am able to run the following query in MS SQL but when I run it in Oracle I am getting errors. I understand t-sql and oracle sql is different, if possible, can you tell me which adjustment I need to make to run it on Oracle RAC. Thank you for your help and time.
SELECT
COUNT (CREATION_DATE)AS 'Door Opens',
Max(DATEPART(yyyy,CREATION_DATE)) AS Year,
Max(DATEPART(MM,CREATION_DATE)) AS Month,
Max(DATEPART(DD,CREATION_DATE)) AS Day,
Max(DATEPART(HH,CREATION_DATE)) AS Hour
FROM
table_name
WHERE
(EVENT_SUB_TYPE = 'fault') AND (EVENT_TYPE = 'z') AND (Prime_FK = 2) AND (SENSOR_ID=3) AND (CREATION_DATE >= GETDATE() - 30)
GROUP BY
DATEADD(HOUR, DATEDIFF(Hour, 0, CREATION_DATE),0),DATEADD(DAY, DATEDIFF(Day, 0, CREATION_DATE),0)
Errors when I run it:
