1

I'm getting a "missing right parenthesis" error with the below query. I do not have a missing parenthesis....

I tried looking at the oracle sql documentation and do not see where there is an issue.

The query is

select *
  from DB.DB
 where OUTAGE_OPENED > DATE_SUB(NOW(), INTERVAL 60 MINUTE)

The full error is

ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" *Cause:
*Action: Error at Line: 25 Column: 48

Column 48 is where I have the 60.

I've tried SUBDATE(the documentation says they are the same when using the arguments I am using). This works in mysql, and it seems like it should work in oracle, but obviously I'm doing something wrong.

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
Anthony Womack
  • 101
  • 2
  • 7

2 Answers2

3

date_sub() is not an Oracle function. Just use intervals:

SELECT * 
FROM DB.DB
WHERE OUTAGE_OPENED > sysdate - INTERVAL '60' MINUTE;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
0

DATE_SUB is available in MySQL but not in Oracle. Although both of these databases are Oracle Corporation products (now) they are the results of completely different development lines (you might compare the history of both products) and thus have major differences, such as their handling of dates and times.