2
votes

Why does the query produce this error?

ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"

select * from
(
  (select * from dual) alias1,

  (select * from dual) alias2
)

I get an error on 10g and 11g

2
just remove the outer () - Amyth

2 Answers

3
votes

Incorrect SQL syntax. Remove outer pair of parenthesis, like this:

select * from 
(select * from dual) alias1, 
(select * from dual) alias2;
1
votes

Your parentheses are balanced, but the parser is confused, and in its confusion, it generated a sub-optimal error message.

You could write something like:

SELECT *
  FROM (SELECT * FROM Dual) Alias1
  JOIN (SELECT * FROM Dual) Alias2 ON 1 = 1;