db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chaa...@apache.org
Subject svn commit: r1160250 - /db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita
Date Mon, 22 Aug 2011 12:59:27 GMT
Author: chaase3
Date: Mon Aug 22 12:59:26 2011
New Revision: 1160250

URL: http://svn.apache.org/viewvc?rev=1160250&view=rev
Log:
DERBY-5385  Improve documentation for OFFSET/FETCH NEXT

Fixes to a Reference Manual topic.

Patch: DERBY-5385.diff

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=1160250&r1=1160249&r2=1160250&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqljoffsetfetch.dita Mon Aug 22 12:59:26 2011
@@ -57,15 +57,16 @@ ROW is synonymous with ROWS and FIRST is
 </p>
 
 <p>
-For the <i>result offset clause</i> the integer literal (or dynamic
-parameter) must be equal to
+For the <i>result offset clause</i>, the value of the integer literal (or the
+dynamic parameter <codeph>?</codeph>) 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 (or dynamic parameter) must be
1 or
+For the <i>fetch first clause</i>, the value of the literal (or the dynamic
+parameter <codeph>?</codeph>) 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,7 +85,16 @@ SELECT * FROM T ORDER BY I OFFSET 10 ROW
 --   returned
 SELECT * FROM T OFFSET 100 ROWS
 
-JDBC:
+-- Use of ORDER BY and FETCH FIRST in a subquery
+SELECT DISTINCT A.ORIG_AIRPORT, B.FLIGHT_ID FROM 
+   (SELECT FLIGHT_ID, ORIG_AIRPORT 
+       FROM FLIGHTS 
+       ORDER BY ORIG_AIRPORT DESC 
+       FETCH FIRST 40 ROWS ONLY) 
+    AS A, FLIGHTAVAILABILITY AS B 
+   WHERE A.FLIGHT_ID = B.FLIGHT_ID
+
+JDBC (using a dynamic parameter):
 PreparedStatement p = 
     con.prepareStatement("SELECT * FROM T ORDER BY I OFFSET ? ROWS");
 p.setInt(1, 100);



Mime
View raw message