Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6A548D25D for ; Fri, 28 Sep 2012 16:51:43 +0000 (UTC) Received: (qmail 80428 invoked by uid 500); 28 Sep 2012 16:51:43 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 80403 invoked by uid 500); 28 Sep 2012 16:51:43 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 80394 invoked by uid 99); 28 Sep 2012 16:51:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2012 16:51:43 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_HI,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rick.hillegas@oracle.com designates 141.146.126.227 as permitted sender) Received: from [141.146.126.227] (HELO acsinet15.oracle.com) (141.146.126.227) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2012 16:51:33 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q8SGpBaO007619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 28 Sep 2012 16:51:11 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8SGpAM0021872 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 28 Sep 2012 16:51:10 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8SGpA5a017463 for ; Fri, 28 Sep 2012 11:51:10 -0500 Received: from dhcp-amer-vpn-rmdc-anyconnect-10-159-91-54.vpn.oracle.com (/10.159.91.54) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Sep 2012 09:51:10 -0700 Message-ID: <5065D576.4040509@oracle.com> Date: Fri, 28 Sep 2012 09:51:02 -0700 From: Rick Hillegas User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: derby-user@db.apache.org Subject: Re: CURRENTVALUE is not "as expected" References: <825199665.138644.1348850211044.JavaMail.root@chemaxon.com> In-Reply-To: <825199665.138644.1348850211044.JavaMail.root@chemaxon.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Virus-Checked: Checked by ClamAV on apache.org 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