1

I got the following oracle-sql-statement:

select xxx.a, xxx.b, xxx.c, xxx.d,
(SELECT e FROM ghj WHERE f in (SELECT u FROM hgz WHERE ddf = xxx.ddf limit 
1)) AS fff
from fcv xxx where k = '100';

I get the following error: ORA-00907: missing right parenthesis ORA-06512: at "SYS.DBMS_SQL", line 1185 ORA-06512: at line 1

Why?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Madness
  • 125
  • 1
  • 10
  • `limit 1` isn't Oracle syntax. (It's expecting a closing parenthesis when it sees `limit`; not an entirely helpful error though). – Alex Poole Jul 25 '18 at 10:40
  • a useful [link](https://stackoverflow.com/questions/470542/how-do-i-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering) – Aleksej Jul 25 '18 at 10:41
  • thank you, that solves the problem! – Madness Jul 25 '18 at 10:58

1 Answers1

0

With respect of the comments remove the limit as its not oracle syntax

select xxx.a,
       xxx.b,
       xxx.c,
       xxx.d,
       (SELECT e FROM ghj WHERE f in (SELECT u FROM hgz WHERE ddf = xxx.ddf 
       FETCH FIRST 1 ROWS ONLY) FETCH FIRST 1 ROWS ONLY) AS fff
  from fcv xxx
 where k = '100';
Madness
  • 125
  • 1
  • 10
Moudiz
  • 7,211
  • 22
  • 78
  • 156