Search code examples
oracle11goracle10gora-00907

ORA-00907: missing right parenthesis, on Oracle 10 and not on Oracle 11


Why the following query fails on Oracle 10 an not on Oracle 11.

SELECT trunc(DBMS_RANDOM.value(low => 10, high =>50)) from dual;

Oracle 10:

ORA-00907: missing right parenthesis 

Solution

  • This answer is a bit speculative, but one possible explanation for the missing right parentheses error is that this error is not really about missing parentheses. Instead, if the API for DBMS_RANDOM.value is different in your version of Oracle 10 vs. Oracle 11 then you could be seeing this error. Try this query instead:

    SELECT TRUNC(DBMS_RANDOM.value(10, 50))
    FROM dual
    

    If this works, then you will know that the API has changed between Oracle 10 and 11.

    Here is a reference which uses the API as I have in my query.