db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <de...@segel.com>
Subject RE: Most efficient way to get max row id?
Date Tue, 21 Oct 2008 14:53:22 GMT


> -----Original Message-----
> From: Kai Ponte [mailto:kai@perfectreign.com]
> Sent: Monday, October 20, 2008 4:48 PM
> To: Derby Discussion
> Subject: Re: Most efficient way to get max row id?
> 
> On Monday 20 October 2008 08:52:34 am derby@segel.com wrote:
> > The table would consist of two columns. A label column and a counter
> > column. Your stored procedure has two options. lastVal() and
> getNextVal(),
> > getNextVal(n). (The last one is optional or could be incrementValTo(n) )
> 
> I've done this also in the past. It simply keeps track of the last value
> of an
> inserted item. That way a web page - disconnected recordset - can insert a
> new item then another page can grab the information from that item.
> 
> 
> 
Yes.

This kind of mimics how Informix's Serial column works or Sybase/Oracle's
sequence numbers work. (There's more to it on their part but you can always
make this simple thing more advanced.)

It's an "older technique" that still has its uses.

 



Mime
View raw message