Syntax error (missing right parenthesis) on some match-recognize expression
See original GitHub issueHere is a query running fine in SQL Developer but failing in DBeaver with a syntax error (missing right parenthesis) when using “{- pattern -}” syntax in a match_recognize expression:
Tried with default ORACLE connection (both version 4 and latest 5.3.2 CE) and with custom one using ojdbc8.jar
WITH t AS (
select to_DATE( '2007-01-01', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-01-15', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-01-03', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-01-10', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-01-12', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-01-25', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-01-20', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-02-01', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-02-05', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-02-10', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-02-05', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-02-28', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-02-10', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-02-15', 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-03-01', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-03-02' , 'YYYY-MM-DD') AS end_date FROM dual
UNION all
select to_DATE( '2007-03-03', 'YYYY-MM-DD') AS start_date, to_DATE( '2007-03-16', 'YYYY-MM-DD') AS end_date FROM dual
)
select start_gap, end_gap from t
match_recognize(
order by start_date
measures max(end_date) start_gap, next(start_date) end_gap
all rows per match
pattern((A| {- B -} )+)
define A as max(end_date) < next(start_date)
);
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
ORA-00907: missing right parenthesis - TekStream Solutions
Error ORA-00907 can commonly occur in commands such as CREATE TABLE, CREATE CLUSTER, and INSERT, which all require an itemized list enclosed in...
Read more >ORA-00907: missing right parenthesis - Stack Overflow
This is one of several generic error messages which indicate our code contains one or more syntax errors. Sometimes it may mean we...
Read more >ORA-00907: missing right parenthesis Solution - Database Star
When working with Oracle SQL, all left parenthesis (the “(” character) must be paired with a right parenthesis character (the “)” character). If ......
Read more >SQL - Just another ORACLE Development blog
00000 - "missing right parenthesis" *Cause: *Action: Error at Line: 11 Column: ... You will also miss the RESTART option in the syntax...
Read more >ORA-00907: missing right parenthesis tips - Burleson Consulting
The symptoms of ORA-00907 and Bug 4433936 are simple syntax errors which happen within parsing queries associated with FULL/LEFT OUTER joins.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes exactly that’s the “problem”, meantime you sent latest message, I tested by copying the original ORACLE connection type instead of creating one from the Generic and now it works…
Good news… thank you
So to resume, complete solution is: copy original ORACLE connection model (NOT creating one from Generic one) change the JAR for the ojdbc8 one check “Disable escaping in SQL scripts”
Ah, I see. You created custom driver using Generic provider? Then yes, this option won’t work.