db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Using/Adressing a "row number" in a SELECT query
Date Sun, 19 Feb 2006 22:05:13 GMT

You might consider using a column that the database automatically  
increments for each inserted row. Then you could select ranges of  
this column values.

It's not clear from your description whether you know in advance that  
you want a certain range of rows that were inserted, or exactly what.

If you're using this for logging, and keeping track of which records  
you have already processed, this technique might work. Since the  
column is visible and won't change after insert, the same technique  
can be used with other databases (e.g. use a sequence on Oracle...)


On Feb 16, 2006, at 11:47 PM, Sylvain RICHET wrote:

> Hi everyone,
> In a selection statement, i would like to get blocks of records.
> Thus, i need to filter records by a "row number", directly at the  
> SELECT level.
> It seems that the way to address a row number is not (SQL) standard.
> (different "proprietary" implementations)
> In Oracle, there is the "rowid".
> In MySQL, the "LIMIT" clause can do it.
> In SQL Server, i think there is the "ROW_NUMBER() OVER..."
> In DB2 (on AS/400) , there is the "RRN" (Relative Record Number)...
> What about Derby database ?
> How is it implemented on this server ?
> I know i could use
> Thanks in advance.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

View raw message