title: ORA-00907 when quering from my Java application but works fine in SQL Developer
body: <p>My query that I put into a prepared statement is:</p>
  
  <pre><code>select * 
    from ( select seq, audit_ts, message_type
             from log2 
            where 1 = 1 
              and message_type in ('SOURCE', 'DEST') 
            order by seq desc ) 
   where ROWNUM &lt;= ?
  </code></pre>
  
  <p>When I run the query in my application, I get: </p>
  
  <blockquote>
    <p>java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis</p>
  </blockquote>
  
  <p><strong>EDIT:</strong> Here is the java executing the query. I am trying to return a set of search results, so the prefix contains the SELECT statement and then I can have any number of suffixes (in this excerpt "AUDIT_LOG_SEARCH2") which are the parameterized WHERE clauses based on the user search: </p>
  
  <pre><code>StringBuffer query = new StringBuffer(300);
  query.append(dbAdapter.getQuery("AUDIT_LOG_ENTRY_PREFIX"));
  query.append(dbAdapter.getQuery("AUDIT_LOG_SEARCH2"));
  
  // Insert parameters to complete the sql prepared statement 
  PreparedStatement ps = _dbConn.prepareStatement(query.toString());
  ResultSet rs = ps.executeQuery();
  </code></pre>
  
  <p>But the query runs fine when I run it separately in SQL Developer. The query was originally created for Postgres, then updated for Oracle. Any tips?</p>