Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 65126 invoked from network); 15 Sep 2006 16:26:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Sep 2006 16:26:05 -0000 Received: (qmail 25981 invoked by uid 500); 15 Sep 2006 16:25:53 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 25949 invoked by uid 500); 15 Sep 2006 16:25:53 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 25938 invoked by uid 99); 15 Sep 2006 16:25:53 -0000 X-ASF-Spam-Status: No, hits=0.9 required=10.0 tests=DNS_FROM_RFC_WHOIS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of asamere@rochester.rr.com designates 24.24.2.56 as permitted sender) Received: from [24.24.2.56] (HELO ms-smtp-02.nyroc.rr.com) (24.24.2.56) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2006 09:25:50 -0700 Received: from [127.0.0.1] (cpe-66-66-11-144.rochester.res.rr.com [66.66.11.144]) by ms-smtp-02.nyroc.rr.com (8.13.6/8.13.6) with ESMTP id k8FGPCfB012023 for ; Fri, 15 Sep 2006 12:25:14 -0400 (EDT) Message-ID: <450AD3EA.3000507@rochester.rr.com> Date: Fri, 15 Sep 2006 12:25:14 -0400 From: Adam J Samere User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: Out of topic, Oracle SEQUENCE References: <82701c100609150917k6d1e9e4dpc222723689f7cd5a@mail.gmail.com> In-Reply-To: <82701c100609150917k6d1e9e4dpc222723689f7cd5a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Use curval to obtain the last selected value for the current oracle session. Note that you cannot access curval until nextval has been used at least once in the current oracle session. select user_seq.curval from dual Daniel Chac�n S�nchez wrote: > Hi I know this the struts mail list, but I have a question and I hope > that > someone know the answer > > I'm using an oracle database, I have a sequence to obtain the nextval > that > will be the key of the row that I will insert, after the insert I need to > know which is that value so I can tell the user with which value the > row was > inserted. Is there a sure fire way to do this, or am I stuck with "select > max(id) from table" and hope nothing else has been inserted in that few > milliseconds it takes to go from my insert statement to my select > statement? > > Some code, for better explanation: > > > CREATE SEQUENCE user_seq INCREMENT 1 MINVALUE 0 NOMAXVALUE START WITH > 0 NOCACHE > NOCYCLE > > > > insert into users values (user_seq .nextval, 'userName'); > > > > Then I need to know the value with which the row was inserted, how can > I do > that > > > Thanks! Sorry fot the out of topic question > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org