Steve Brett wrote:

> does Sapdb suport Limit (as in 'select * from patient limit 
> 10') in any
> sense ?
> 
> is there an alternative ?
> 
> i am looking in the docs now and can't find anything ....
> 


Sometimes looking in the archives may help, especially in case 
of our beloved topic limit. Here you can find for example:


A short part out of our reference manual:

ROWNO predicate 

The ROWNO predicate restricts the number of lines in a result table (see
result table name). 

Syntax

<rowno predicate> ::= ROWNO < <unsigned integer | parameter spec> 
| ROWNO <= <unsigned integer | parameter spec>

unsigned integer, parameter spec

Explanation

A ROWNO predicate may only be used in a WHERE clause that belongs to a QUERY
statement. The ROWNO predicate can be used like any other predicate in the
WHERE clause if the following restrictions are observed:

The ROWNO predicate must be linked to the other predicates by a logic AND 
The ROWNO predicate must not be negated 
The ROWNO predicate may not be used more than once in the WHERE clause
You can specify the maximum number of lines in the result table using an
unsigned integer or a parameter specification. The specified value must
allow the result table to contain at least one row. If more lines are found,
they are simply ignored and do not lead to an error message.

If a ROWNO predicate and an ORDER clause are specified, only the first n
result lines are searched and sorted. The result usually differs from that
which would have been obtained if a ROWNO predicate had not been used and if
the first n result rows had been considered.

If a ROWNO predicate and a set function are specified, the set function is
only applied to the number of lines restricted by the ROWNO predicate.


You see: an upper limit can be specified, but nothing like 'the 51th to 75
row'.


or this mail:


It is not possible, to use an offset directly.
Do :
  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

FETCH POS (n) jumps to the n-th result and returns it.
FETCH NEXT will give the next result from that point.


You will find more discussions about 'limit' and 'top' in the archives:

to give people a chance to search by their own 
if their problem was discussed and possibly solved
here three archives of this mailing list:

starting in November 2001, therefore not complete from the beginning:
http://groups.yahoo.com/group/sapdb-general

starting December 2000, therefore the full list (and some other interesting
stuff concerning SAP DB), thanks to a mailing list member:
http://sapdb.icf.net 

Our own archive can be found here:
http://listserv.sap.com/pipermail/sapdb.general/


Elke
SAP Labs Berlin

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to