You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2009/08/25 04:29:52 UTC

svn commit: r807458 - /db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita

Author: dag
Date: Tue Aug 25 02:29:51 2009
New Revision: 807458

URL: http://svn.apache.org/viewvc?rev=807458&view=rev
Log:
DERBY-4208 Parameters ? with OFFSET and/or FETCH

Patch derby4208-docs-b, which updates the documentation change for this issue.

Modified:
    db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita

Modified: db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita?rev=807458&r1=807457&r2=807458&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita Tue Aug 25 02:29:51 2009
@@ -47,24 +47,25 @@
 
 <refsyn>
   <title>Syntax</title> 
-  <codeblock><b>OFFSET <i>integer-literal</i> {ROW | ROWS}
+  <codeblock><b>OFFSET { <i>integer-literal</i> | ? } {ROW | ROWS}
     </b></codeblock> 
 
-  <codeblock><b>FETCH { FIRST | NEXT } [<i>integer-literal</i>] {ROW | ROWS} ONLY
+  <codeblock><b>FETCH { FIRST | NEXT } [<i>integer-literal</i> | ? ] {ROW | ROWS} ONLY
     </b></codeblock> 
 <p>
 ROW is synonymous with ROWS and FIRST is synonymous with NEXT.
 </p>
 
 <p>
-For the <i>result offset clause</i> the integer literal must be equal to
+For the <i>result offset clause</i> the integer literal (or dynamic
+parameter) must be equal to
 0 (default if the clause is not given), or positive. If it is larger
 than the number of rows in the underlying result set, no rows are
 returned.
 </p>
 
 <p>
-For the <i>fetch first clause</i>, the literal must be 1 or
+For the <i>fetch first clause</i>, the literal (or dynamic parameter) must be 1 or
 higher. The literal can be omitted, in which case it defaults to 1. If
 the clause is omitted entirely, all rows (or those rows remaining if
 a <i>result offset clause</i> is also given) will be returned.
@@ -84,6 +85,12 @@
 -- If the table has fewer than 101 records, an empty result set is
 --   returned
 SELECT * FROM T OFFSET 100 ROWS
+
+JDBC:
+PreparedStatement p = 
+    con.prepareStatement("SELECT * FROM T ORDER BY I OFFSET ? ROWS");
+p.setInt(1, 100);
+ResultSet rs = p.executeQuery();
 </b></codeblock>
 <note>
 Make sure to specify the ORDER BY clause if you