3 Replies Latest reply on Aug 7, 2008 9:31 PM by alwu-Oracle

    ORA-00936: missing expression

    652134
      Hello,
      I wrote a SPARQL query that returned a variable called ?date. When I ran the query using the Jena Adaptor, I kept getting:

      java.sql.SQLException: ORA-00936: missing expression

      I think the SQL parser was not handling the ?date variable correctly. Insetadn, I think the parser interpreted ?date as the Oracle DATE keyword. When I changed the variable name to ?article_date, the problem went away. It's not a big problem, but I just wanted to point it out.

      Chuck
        • 1. Re: ORA-00936: missing expression
          alwu-Oracle
          It is a known limitation of SQL. There are some reserved keywords that cannot be used freely.
          • 2. Re: ORA-00936: missing expression
            652134
            Thanks for the explanation. I think it would be better if the SPARQL interpreter captured known Oracle reserved words when trying to execute SPARQL queries. If the interpreter threw an error that said "ORA-00000: Reserved Oracle Keyword found in SPARQL query" then I would realize my mistake. The error "ORA-00936: missing expression" message didn't make much sense when I saw it. I am writing a SPARQL query, not a SQL query. I think people writing SPARQL queries are going to be more focused on what is allowed/disallowed according to the SPARQL specification.

            To be honest, I am surprised the SPARQL interpreter allows Oracle keywords. Isn't it a little dangerous to allow the Oracle keywords? According to my error, Oracle was executing the DATE keyword. Doesn't that allow the possibility of something similar to "SQL Injection"? What if I used the keyword DROP, CREATE, etc?
            • 3. Re: ORA-00936: missing expression
              alwu-Oracle
              If you put in, unintentionally, some Oracle keywords, then you get an error when query is executed. There is no danger other than it is inconvenient. The same behavior is in a regular SQL select execution. For example,

              SQL> select drop from (select 1 "drop" from dual);
              select drop from (select 1 "drop" from dual)
              *
              ERROR at line 1:
              ORA-00936: missing expression


              I am logging an enhancement to translate Oracle keywords, for a future Jena Adaptor release.