Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4541

precompile statement with result offset and fetch first clauses

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.5.3.0
    • Fix Version/s: 10.6.1.0
    • Component/s: SQL
    • Environment:

      Description

      hi,

      i'm getting an error while precompiling a prepared statement with offset and fetch first clauses.

      the documentation (http://db.apache.org/derby/docs/dev/ref/rrefsqljoffsetfetch.html#rrefsqljoffsetfetch), provides following example:

      SELECT * FROM T ORDER BY I OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY

      the prepared statement looks like:

      Connection con = datasource.getConnection();
      PreparedStatement p = con.prepareStatement("SELECT * FROM T ORDER BY I OFFSET ? ROWS FETCH NEXT ? ROWS ONLY");

      but an SQLException is thrown: Syntax error: Encountered "?" at line 1, column 60.

      i'm using following version of derby:
      Bundle-Name: Apache Derby 10.5
      Bundle-Version: 10.5.3000000.802917

      the connection is created from a container-managed connection-pool datasource:

      <Resource
      name="jdbc/prototype"
      auth="Container"
      type="javax.sql.DataSource"
      driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
      url="jdbc:derby:memory:prototype;create=true"
      username=""
      password=""
      maxActive="10"
      maxIdle="5"
      maxWait="10000"
      />

      thank you for your support,
      burk

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                burk burk mayer
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: