db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: CURRENTVALUE is not "as expected"
Date Fri, 28 Sep 2012 16:51:02 GMT
On 9/28/12 9:36 AM, Daniel Butler wrote:
> Hi there,
>
> I was trying to access/use:
>
> SELECT CURRENTVALUE FROM SYS.SYSSEQUENCES WHERE SEQUENCENAME='SOMETHING'
>
> It appears not to return the expected value, in fact it seem to add 5 
> to the expected value or some other number but not what is expected.
>
> Surely this cannot be considered correct/reasonable ?
> Is there any way to access the real CURRENTVALUE (I don't think 
> (CURRENTVALUE-X) is a good solution, since it is not clear what X 
> should be at any one time)
>
> Thanks,
> Daniel Butler.
Hi Daniel,

Directly selecting from sys.sysequences will cause concurrency problems 
for your application. Probably what you want to do is call the builtin 
function SYSCS_UTIL.SYSCS_PEEK_AT_SEQUENCE. The behavior you are seeing 
is explained by the Derby Reference Guide in the section titled 
"SYSCS_UTIL.SYSCS_PEEK_AT_SEQUENCE system function".

Hope this helps,
-Rick

Mime
View raw message