RE: Replacing Limit x,y with JDBC
"Schroeder, Alexander" <[email protected]> Thu, 8 May 2003 09:54:34 +0200
| Newsgroups | gmane.comp.db.sapdb.sources,gmane.comp.db.sapdb.general |
|---|---|
| Message-ID | <52F518B40AE66944A6F62699ADE3F04101D9ACBA@dewdfx2g> |
Hi, first, as your question was about general use of SAP DB, I suggest using [email protected] , sapdb.sources is about development of the SAP DB software itself. Second, unfortunately, the MySQL LIMIT x,y syntax cannot generally be mapped into a single SQL call. For 'y', I suggest using the Statement.setMaxRow(int) method, which is the usual portable way to tell the JDBC driver to retrieve at most 'y' records. For 'x', you will need to call the 'absolute(int)' method on the result set, which will result in a 'FETCH POS' command being executed. Regards Alexander Schröder SAP DB, SAP Labs Berlin > -----Original Message----- > From: [email protected] [mailto:[email protected]] > Sent: Thursday, May 08, 2003 1:16 AM > To: [email protected] > Subject: [SAP DB Dev] Replacing Limit x,y with JDBC > > > Hi, > > Am migrating our db from mySQL which has Limit X,Y function, to SAP. > > I saw on the list a suggestiong to use > > SELECT * from tbl WHERE ROWNO <= 20 > FETCH POS (10) INTO ... (if you want to see > result number 10, > otherwise use 11) > Loop > FETCH NEXT INTO ... > Endloop > > But don't see how that will work with a single JDBC call. > > Does anyone know how to mimic this with a single call? > > Many thanks, > > David > > > > _______________________________________________ > sapdb.sources mailing list > [email protected] > http://listserv.sap.com/mailman/listinfo/sapdb.sources >