Skip to Main Content

RAC Query Problems

User_H95GNSep 18 2017 — edited Sep 18 2017

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: 

pastedImage_0.png

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Oct 16 2017
Added on Sep 18 2017
16 comments
324 views