java.sql.SQLException:ORA-00907:缺少右括号

时间:2016-05-15 19:22:32

标签: sql

执行以下代码时出现此错误;我不明白为什么会发生这种异常:

java.sql.SQLException: ORA-00907: missing right parenthesis

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1038)
    at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1133)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
    at com.test.Test.main(Test.java:32)




    String query = "select usrid, status, mob, msg from ( "
                    + "selet usrid, status, mob, msg, ROW_NUMBER() OVER (order by usrid) R from smsreport "
                    + ") where R BETWEEN 2 AND 10 ";

            PreparedStatement pstmt = con.prepareStatement(query);
            ResultSet result = pstmt.executeQuery();

当在SQL数据库中执行相同的查询时,它执行得很好。

Error Message

0 个答案:

没有答案